how can we make our java program run from any location irrespective of its original location ?
ANS----------------->
Use classpath support.
eg.
|------->java
|------->pd.java
pd.java
public class pd{
public static void main(String ars[]){
System.out.println(" welcome to java ");
}
}
E:\java>javac pd.java
E:\java>java pd
D:\movie>java pd (error)
Solution:
Add the address location pd.class to classpath environment variable.
Variable name : CLASSPATH
Value : E:\java
press ok (3 times)
D:\movie> java pd.java (success)
ANS----------------->
Use classpath support.
eg.
|------->java
|------->pd.java
pd.java
public class pd{
public static void main(String ars[]){
System.out.println(" welcome to java ");
}
}
E:\java>javac pd.java
E:\java>java pd
D:\movie>java pd (error)
Solution:
Add the address location pd.class to classpath environment variable.
Variable name : CLASSPATH
Value : E:\java
press ok (3 times)
D:\movie> java pd.java (success)
No comments:
Post a Comment