• Post Reply Bookmark Topic Watch Topic
  • New Topic

Java on Linux  RSS feed

 
Rachel Swailes
Ranch Hand
Posts: 434
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am trying to get a simple java program to run on our Linux Web Server.

I have access as a user to the box and I have put my class files in a folder named /usr/home/ll/

Then I tried to run my program like so...

java -classpath /usr/home/ll/ HelloWorld

But I get the error that "java" is unrecognised.

Please could someone give me some advice has to how to run this program. I have not used Linux with Java before so I am trying to learn.

Many kind regards,
Rachel
 
Petr Blahos
Ranch Hand
Posts: 131
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Rachel,

Are you sure java is installed on the machine? An exact messsage
you got would help, but it looks like it may be not there. Just
to make sure, you can do following:
- Just type java
- If you get something like "Command not found", try locate javac.
- If you get something like "database does not exist", well we will
sort it in another post.
- If it found something, it may be something like:
/usr/java/j2sdk1.4_04/bin/javac
- If it didn't found anything, then java is probably not installed.

BTW, easiest fix: If you are on good terms with an administrator
of that machine, talk to him or her.

- Now if this locate javac found, let's say:
/usr/java/j2sdk1.4_04/bin/javac
you need to add it to your path and you might want to
setup JAVA_HOME directory. The path thing:
type:
export PATH=${PATH}:/usr/java/j2sdk1.4_04/bin
(or whatever path it is)
export JAVA_HOME=/usr/java/j2sdk1.4_04
(I don't think you need it but it may be used by some packages)

Try java now. If it works, good, but when you log in next time
you will need to do the "export ..." stuff again. Of course it
can be mended. You know what? Let me know how it went and we will
continue when we have some more info...

Best regards,
Petr
 
Rachel Swailes
Ranch Hand
Posts: 434
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Petr

When I type in 'java' i get the error
bash: java: command not found

So I guess that java is not set up correctly. I'm going to get at my Sys Admin guy and make sure that it's installed.

Thanks for the advice and I'll let you know how it goes.

Cheers,
RAchel
 
Dirk Schreckmann
Sheriff
Posts: 7023
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Moving this to the Linux / UNIX forum...
 
Stefan Wagner
Ranch Hand
Posts: 1923
Linux Postgres Database Scala
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hy Rachel,
you have probably overseen, that 'locate java' isn't just a hint, but a command.

another one is 'whereis'
 
Rachel Swailes
Ranch Hand
Posts: 434
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for all your help. The Sys Admin guy got back to me and showed me where it is so it is finally working fine.

Now to get me a Linux tutorial and get studying!
Cheers,
Rachel
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!