how can i run java program from any where


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting how can i run java program from any where
# 1  
Old 06-12-2006
how can i run java program from any where

Hello all sorry didnt know where to post it
i compiled simple program that using "System.getProperty("user.dir");"
now i compiled the program under directory foo and and its running great when i do "java myapp"
i included this directory in the $PATH env variable so i could see it fro any where in the system
but now when i try to run this java app from other place in the file system with "java myapp" it gives me "Exception in thread "main" java.lang.NoClassDefFoundError:" erorr . why is that ?
Thanks
# 2  
Old 06-12-2006
You have to set the CLASSPATH

or specify the classpath at runtime like

java -cp /local/foo classfile

Last edited by sssow; 06-12-2006 at 10:43 PM..
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

java compile and run program help

What is the trick to get a java program to run and compile? I can't even get a basic skeleton to run and compile. What packages do I need? I figured the java-gcj and gcc-java packages was enough. Do I need any other packages? I thought I had to do this and it would work but its not. javac... (1 Reply)
Discussion started by: cokedude
1 Replies

2. Programming

Program java arguments

Hello, The arguments are strings. In my code I need them to be a different type, I do the cast but it is not feasible ... Have you any idea? Thank you (8 Replies)
Discussion started by: chercheur857
8 Replies

3. Programming

Connecting ssh in java program

Hi I have been trying to connect a remote linux server in a java program through ssh. Can anyone tell me the proper library to include? Thanks Ananth (0 Replies)
Discussion started by: Ananthdoss
0 Replies

4. Programming

need logic for java program

Hi All, I need to to wright a java programm for the following query. Qus: output need to genarate a number+ alphnumric sequence in java and get converted into ASCII code so that i can use mod logic on that. example Output: like 10 digit number 1AAAAAAAAA 1AAAAAAAAB 1AAAAAAAAC . .... (4 Replies)
Discussion started by: Ganesh Khandare
4 Replies

5. UNIX for Dummies Questions & Answers

Help needed to run simple java program in linux

Hi guys , This is the first time i m running java application inside linux. i have installed jdk-6u20-linux-i586-rpm.bin jre-6u20-linux-i586-rpm.bin in my linux machine. and set JAVA_HOME and JRE_HOME variables respectively. # echo $JAVA_HOME /usr/java/jdk1.6.0_20/ # echo $JRE_HOME... (6 Replies)
Discussion started by: pinga123
6 Replies

6. Shell Programming and Scripting

Executing a Java Program

I am entirely new to shell scripting and would like to create a script to execute a java program called Main. I've already compiled it and placed the .java and .class files at /root/javaTest. Next I made a shell script that simply contained: java /root/javaTest/Main . I made the script... (2 Replies)
Discussion started by: hypnotic_meat
2 Replies

7. Linux

running java program question

hi, i have just written a simple hello world java program in my linux server, installed jdk ... and tried to compile and run it and it gave me some errors. please details below: # cat HelloWorld.java import java.util.*; import java.io.*; public class HelloWorld { public static void... (4 Replies)
Discussion started by: k2k
4 Replies

8. UNIX for Dummies Questions & Answers

using a variable from java program in unix

Hi, I need to execute a java program in a shell script.I then need to assign the value being returned by the program into a unix variable.Is there any way i can access the value in a variable in java program? As in if my java code has a variable, . . . . valueA =x.getValue() ..... can... (1 Reply)
Discussion started by: inquisitive101
1 Replies

9. UNIX for Dummies Questions & Answers

executing the su command from a java program.

Say in unix (AIX) m/c, I am logged in with s1 user and want to start process p1 with user credentials of s2. I can do manually in this way: #su - s2 #enter password for s2> somePassword $ p1 But all this I have to do through a java program. How to pass the password through program. One... (1 Reply)
Discussion started by: shailendrat
1 Replies

10. Programming

Communication between a java and c++ program

Hi, I have the following problem. I have 2 programs, a java program and a c++ program. These 2 programs have to communicate with each other in full duplex mode. I want to use pipes for this communication. So when the c++ program pust something on the stdout the java program must be able to read... (4 Replies)
Discussion started by: lmnt22
4 Replies
Login or Register to Ask a Question