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

Reply
 
Thread Tools Search this Thread
  #1  
Old 29-03-2010
Member
 
Join Date: Mar 2010
Posts: 197
Executing java program via a script

Hello,
I have a problem of execution of a java program. When I want to execute via a shell script I have a message that appears and shows me the driver I use:
Code:
org.postgresql.Driver
However when I type the same command in the terminal's functions using the java commands it works. If someone has an idea let me know. Thanks in advance.
Reply With Quote
  #2  
Old 29-03-2010
Member
 
Join Date: Nov 2009
Posts: 446
Re: Executing java program via a script

Hello,
You batch file or the shell file should have the exact command as you do it with the java commands.
I feel that the line indicating the driver is because:
- Or the driver has not been found, and this line is displayed by the management that you would do except "ClassNotFound" (=> problem of classpath)
- Is not the right class is launched (if you work with a jar containing several hand for example)
Reply With Quote
  #3  
Old 29-03-2010
Member
 
Join Date: Dec 2009
Posts: 178
Re: Executing java program via a script

Hello,
I do have the same problem, I try to run a shell file which has the java command line arguments and the executing statement in the shell file. As you said I have defined the class path in my environment. Yet in my CLASSPATH I said or thought the drivers:
Code:
CLASSPATH =.: / usr/lib/java/pg74.JDBC3.jar
Do you have any idea about this. Also if you have any alternative to run the java programs in linux, then let me know. Thanks in advance.
Reply With Quote
  #4  
Old 29-03-2010
Member
 
Join Date: Nov 2009
Posts: 335
Re: Executing java program via a script

Hello,
Quote:
CLASSPATH =.: / usr/lib/java/pg74.JDBC3.jar
Option
Code:
-classpath
replaces the environment variable CLASSPATH. I advise instead to remove the latter (which can impact all your programs) and use only -classpath. If you need more help on the class path the you can visit here
Installing Java JDK and setting PATH
Reply With Quote
  #5  
Old 29-03-2010
Member
 
Join Date: Nov 2009
Posts: 518
Re: Executing java program via a script

Hello,
The difference may also come from the environment Executive of your shell and your command line. Have you done one source (shell command) particular to establish a special env for your application? Sometimes. Bash_profile you have options that make it. Bashrc is used to reset the variable type BASH_ENV which is positioned at once regardless of the change in the env shell that you use to launch your Java application, a script boot from that shell will use yet a different approx.
Reply With Quote
  #6  
Old 29-03-2010
Member
 
Join Date: Mar 2010
Posts: 197
Re: Executing java program via a script

Hello,
By using -classpath and putting the value of my CLASSPATH environment variable its seems to work. Also, you link has helped me a lot. I have a question for you guys, is it that I have to define the path for every separate user under linux operating system. Is there to define it for the root user. By the way thanks for your help. Any answer is appreciated.
Reply With Quote
Reply

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



Thread Tools Search this Thread
Search this Thread:

Advanced Search


Similar Threads for: "Executing java program via a script"
Thread Thread Starter Forum Replies Last Post
Compiling and Executing a Python program. Blake's Software Development 3 15-02-2012 04:46 PM
Not able to see HDAPM program executing Brandon67 Portable Devices 4 24-05-2010 02:38 PM
Executing a program with exec perl Ash maker Software Development 5 08-03-2010 02:02 PM
Link List Example in Java Sample program in Java trickson Software Development 2 04-08-2009 08:23 PM
can someone look at this script? JAVA Daren Software Development 2 07-03-2009 08:26 PM


All times are GMT +5.5. The time now is 02:30 PM.