Go Back   TechArena Community > Software > Software Development
Become a Member!
Forgot your username/password?
Register Tags Active Topics RSS Search Mark Forums Read

Sponsored Links



How to run java on UNIX

Software Development


Reply
 
Thread Tools Search this Thread
  #1  
Old 28-12-2010
Member
 
Join Date: Oct 2010
Posts: 96
How to run java on UNIX
  

I want to know that can i run java language in UNIX system, if yes then how, I had not used UNIX till yet, but if i install UNIX in my system then, can i run java on it. I have used operating system like windows xp, vista,windows 7, but never used UNIX or LINUX. please tell me the procedure of installing java on UNIX and how to run java on it.

Reply With Quote
  #2  
Old 28-12-2010
Member
 
Join Date: May 2008
Posts: 913
Re: How to run java on UNIX

Yes you can run a JAVA language in UNIX system because java is platform independent language.To run a java program you have to first install a jdk software of java in your system. There are different versions in jdk like jdk1.0,jdk2.0,jdk3.0.....jdk5.0. Any version will get compatible with your system. After installing you have to run java program from unix shell script.You must have jar files and classpath execution stuff.Below script will help you to run java program in any location.


#!/bin/sh
#- Main Base directories
chmod 777 thisshellscriptname.sh
echo "******* Enter your tool or project title *********"
# If you want some input from user
echo 'Enter Java Location************'
# or
# if you want java location
read varname
# Base dir path here (where your related jar files are located)

BASE_DIR="type path here"

#- Main .jar files
YOUR_JAR={BASE_DIR}/lib/YOUR_JARFILE.jar"
#- java
JAVA_EXECUTABLE="/usr/java/bin/java"
JAVA_HOME=`dirname /usr/java/bin/java`"/.."
#- main classpath

YOURCLASSPATH=.:${YOUR_JAR}

#- launching command
echo '**************YOUR TOOL NAME *************'
/usr/jdk1.5.0/bin/java -cp $YOURCLASSPATH MainClassFileName
# or

$varnamejava -cp $YOURCLASSPATH MainClassFileName
echo 'Successfully *****'
exit 0
Now you can run java program on your UNIX system.
Reply With Quote
  #3  
Old 28-12-2010
Member
 
Join Date: Nov 2008
Posts: 1,054
Re: How to run java on UNIX

To run java program you must compile a java program in UNIX environment for that you must trigger jdk setup file. Follow the steps to do it :
1).Open your .login file for editing e.g., by typing > pico .login
if you are using a pico editor.

2). Go to the end of the .login file and add the following code in there (Make sure you do not make any other changes)

###########################################################################
#
# Source the jdk files
#
if (-r /usr/usc/jdk/1.4.2/setup.csh) then
source /usr/usc/jdk/1.4.2/setup.csh
endif
###########################################################################

3).Save the modified .login file.
4).Now you need to source the modified .login file by typing
> source .login
now you can start compiling your java program.
Reply With Quote
  #4  
Old 28-12-2010
Member
 
Join Date: May 2008
Posts: 979
Re: How to run java on UNIX

You can execute your java program on UNIX. You must installed jdk first and should compile the code. after compiling you need to execute your code.To execute already compiled code prog_Name.java, you have to type
> java prog_Name at the UNIX prompt. Again, you must be in the directory where your program was compiled.
Reply With Quote
Reply

  TechArena Community > Software > Software Development
Tags: , , , ,



Thread Tools Search this Thread
Search this Thread:

Advanced Search


Similar Threads for: "How to run java on UNIX"
Thread Thread Starter Forum Replies Last Post
how to connect vb with unix Mewad Operating Systems 5 03-01-2011 08:13 PM
Unix Toolbox visioneye Windows Software 6 13-05-2010 11:45 PM
Where can i get OpenBSD Unix Steyn Operating Systems 3 20-08-2009 05:44 PM
To run Linux AIM in Unix ? Ebenezer Operating Systems 3 19-03-2009 03:55 PM
Learn UNIX! rupak Ebooks 4 14-08-2008 03:08 PM


All times are GMT +5.5. The time now is 10:15 AM.