Hi,
I wasn't sure whether this should be posted in the Java are or in a
Solaris thread, so I shall post it in both. Sorry for the
duplication.
I am new to Solaris and am having trouble running a long Java command
from a shell script.
Firstly, my Solaris (8) / Java setup. Mu machine already had Java 1.2
installed in it in /usr/bin, I have now installed 1.4 into a different
directory. My sub users have had their PATH variable changed to
reference the new Java installation, such that 'which java' results in
/new_java_dir/java.
I have a long java command that gets cut off from the command line, in
Windows I have got round this by specifying it in a batch file, so am
trying to do the same in Solaris. The java command contains a single
jvm arg, which specifies the property file to be used. I first of all
tried to run the script using
#!/usr/bin/java
java long_classpath system_props my.class.name myapp.properties
The output from this indicates that the property file cannot be found.
I have ensured that the . (where the file is stored) is in the
classpath, adn also specifying the full path to the file. The same
error occurs where I use #!/bin/sh to run this script. When I try a
noddy, just running a shorter command from the command line, the arg
gets found ok.
When I try to specify my new java installation in the first line, i.e.
/new_java_dir/java I get the this error:
Error: could not find libjava.so
Error: could not find Java 2 Runtime Environment
Any help would be greatly appreciated, I've been struggling with this
all day...
Thanks,
Laura 4 11989
Hi again,
Thanks to an answer I got from the Solaris group I have now tidied up
my installation, and am fairly confident that java is being called
correctly. However, I am still having problems finding the file
specified by my main method arg... If anyone has any idea what I am
doing wrong in my set up below it would be great :)
I have a bin directory, which contains my script and all property
files, it also contains a libs directory which in turn contains the
jars my application needs to run.
My script is like this:
#!/bin/sh
JAVA_HOME=/usr/java
PATH=$JAVA_HOME/bin:$PATH
export PATH JAVA_HOME
java -version
java -classpath .:./libs/first.jar:./libs/second.jar:./libs/nth.jar
-DLOG_AREA=logs/ -DFTP_BUFFER_SIZE=32768 com.my.main.MainClass
myapp.props
When I run the script the correct java version is printed then I get a
FileNotFound exception for myapp.props (No such file or directory).
The property file is definitely in the directory that the script runs
from. I have also tried using "java <...> ./myapp.props" and "java
<...> /full/path/from/root/myapp.props", both of which give the same
exception. I have tried settin full read/write/exec permissions for
all users on "myapp.props" just to be sure, to no avail, and also
tried creating a jar contining the props file and adding that jar to
the classpath (although I didn't really except that to work as I have
the feeling I would need to change my application code to access the
jar as a resource.)
I have had a very similar setup running in Windows with the same code
and classpath directories, running from a batch file. I can't work
out what is different and wrong about my Solaris setup...
Any ideas??
Thanks in advance,
Laura
Laura,
Please post the code you are using to open the props file. Also, post
the output from the command line when you run the script. To verify the
permissions of the file, please post the output from "ls -l" and
"whoami" as well.
Also, I noticed in your script that you are using relative paths. While
this may or may not be the problem, I believe it to be a poor practice.
The script may be invoked from any directory, which would cause the
paths to be invalid.
Ray
Laura,
Please post the code you are using to open the props file. Also, post
the output from the command line when you run the script. To verify the
permissions of the file, please post the output from "ls -l" and
"whoami" as well.
Also, I noticed in your script that you are using relative paths. While
this may or may not be the problem, I believe it to be a poor practice.
The script may be invoked from any directory, which would cause the
paths to be invalid.
Ray
Thanks, for your suggestions, however I have now found the problem.
I had been using dtpad to view and edit my script,which doesn't show
whitespace characters When I checked the truss report it was trying to
open app.properties^M, which doesn't exist.
Cheers! Please post the code you are using to open the props file. Also, post the output from the command line when you run the script. To verify the permissions of the file, please post the output from "ls -l" and "whoami" as well.
Also, I noticed in your script that you are using relative paths. While this may or may not be the problem, I believe it to be a poor practice. The script may be invoked from any directory, which would cause the paths to be invalid.
Ray This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Adi |
last post by:
A java program we have written crashes with IBM JDK 1.3.1 on linux.
It works fine on other platforms(Solaris,HPUx). It gets a SIGSERV
Signal 11 and crashes just after few minutes after starting up....
|
by: Hal Vaughan |
last post by:
I'm having trouble with a bash script (in Linux) I'm running from Java. It
works -- some of the time, but I can't determine exactly why it works 1
time and doesn't work the next 4-5 times.
I'm...
|
by: Erik Geiger |
last post by:
Hi,
sorry, my english ist not that got but I'll try.
I have a running python script (capisuit incoming.py). This script shall
start a linux shell script. If I start this script like...
|
by: paulhjwu |
last post by:
Hi,
I have problems running a couple of shell scripts from PHP. I found a
similar
posting, so I posted my question to the original author. But
unfortunately the
original author is not at the...
|
by: Gregor Kovač |
last post by:
Hi!
I have an SQL script with bunch of CREATE TABLES, ALTER TABLES, ...
I'd like it to run transactially. I have found that id I run a ALTER
STATEMENT inside a transaction and then roll it back...
|
by: wattersmt |
last post by:
Hello,
I am trying to write a python cgi that calls a script over ssh, the
problem is the script takes a very long time to execute so Apache
makes the CGI time out and I never see any output. ...
|
by: smitanaik |
last post by:
i have a java file which i am running through shell script.
the syntax that i have used is
#! /bin/bash
javac Copy.java
|
by: Propad |
last post by:
Hello,
I know this issue pops up once in a while, but I haven't found a good
answer to it. I need to debug a long running application under
windows. The application is a combined java/python...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 2 August 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM)
The start time is equivalent to 19:00 (7PM) in Central...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 6 Sept 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM)
The start time is equivalent to 19:00 (7PM) in Central...
|
by: Taofi |
last post by:
I try to insert a new record but the error message says the number of query names and destination fields are not the same
This are my field names
ID, Budgeted, Actual, Status and Differences
...
|
by: DJRhino1175 |
last post by:
When I run this code I get an error, its Run-time error# 424 Object required...This is my first attempt at doing something like this. I test the entire code and it worked until I added this -
If...
|
by: Rina0 |
last post by:
I am looking for a Python code to find the longest common subsequence of two strings. I found this blog post that describes the length of longest common subsequence problem and provides a solution in...
|
by: DJRhino |
last post by:
Private Sub CboDrawingID_BeforeUpdate(Cancel As Integer)
If = 310029923 Or 310030138 Or 310030152 Or 310030346 Or 310030348 Or _
310030356 Or 310030359 Or 310030362 Or...
|
by: lllomh |
last post by:
Define the method first
this.state = {
buttonBackgroundColor: 'green',
isBlinking: false, // A new status is added to identify whether the button is blinking or not
}
autoStart=()=>{
|
by: lllomh |
last post by:
How does React native implement an English player?
|
by: DJRhino |
last post by:
Was curious if anyone else was having this same issue or not....
I was just Up/Down graded to windows 11 and now my access combo boxes are not acting right. With win 10 I could start typing...
| |