Showing posts with label windows. Show all posts
Showing posts with label windows. Show all posts

Monday, 13 October 2014

Setting Up Tomcat For Remote Debugging Windows

Debugging a J2EE application is one of the most basic needs of a developer. We can debug a standalone application easily by adding one breakpoint and running the debugger.However debugging a remotely hosted application needs to have a certain application server specific settings

For this you need to configure JPDA (Java Platform Debugger Architecture) in your tomcat.

Add the following two lines in the first line of tomcat's "startup.bat"


set JPDA_ADDRESS=8000
set JPDA_TRANSPORT=dt_socket

Your startup.bat may now be like - 

set JPDA_ADDRESS=8000
set JPDA_TRANSPORT=dt_socket
if "%OS%" == "Windows_NT" setlocal
and so on 

Replace the line 
call "%EXECUTABLE%" start %CMD_LINE_ARGS%

with 

call "%EXECUTABLE%" jpda start %CMD_LINE_ARGS%

Restart the server. 
Your tomcat is setup for remote debugging. 


Wednesday, 3 September 2014

How to find which OS you are working on ?

       For some projects you will need to find out which OS you are working on or on which Operating System the code is deployed. This may be needed in certain cases like - File System Handling ,
Data upload system, Electronic Records System etc because the file organization of different operating systems are indifferent.


For the list of other system properties/ System environment variables please click here


       The following code sample in Java gives this -



 package com.util;  
 public class FindOS{  
      private static String OS = System.getProperty("os.name").toLowerCase();  
      public static void main(String[] args) {  
           System.out.println(OS);  
           if (isWindows()) {  
                System.out.println("This is Windows");  
           } else if (isMac()) {  
                System.out.println("This is Mac");  
           } else if (isUnix()) {  
                System.out.println("This is Unix or Linux");  
           } else if (isSolaris()) {  
                System.out.println("This is Solaris");  
           } else {  
                System.out.println("Your OS is not support!!");  
           }  
      }  
      public static boolean isWindows() {  
           return (OS.indexOf("win") >= 0);  
      }  
      public static boolean isMac() {  
           return (OS.indexOf("mac") >= 0);  
      }  
      public static boolean isUnix() {  
           return (OS.indexOf("nix") >= 0 || OS.indexOf("nux") >= 0 || OS.indexOf("aix") > 0 );  
      }  
      public static boolean isSolaris() {  
           return (OS.indexOf("sunos") >= 0);  
      }  
 }