LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Run Java apps (https://www.linuxquestions.org/questions/linux-newbie-8/run-java-apps-59984/)

Marcos Van 05-15-2003 04:53 PM

Run Java apps
 
Hi all,

I have successfully installed Sun's JDK 1.4 on a new Mandrake 9.1 distro.

Many java applications that I try to run though stat by opening a blank window, but then no controls are drawn within them..

For example, I just installed JEdit and when I try either typeing "jedit" in the run command box or typing "java -jar jedit.jar" from a console window the result is the same empty white box in the middle of the screen.

Does anyone know what could be causing this??

Thanks for the help.

Marcos

Hangdog42 05-15-2003 07:47 PM

Are there any error messages in the console window?

Marcos Van 05-15-2003 10:15 PM

Here is a partial list of the errors that come up when trying to run JEdit.

Sorry if this is a bit overkill..

I am using JDK 1.4.1_02

Thanks



[jim@localhost 4.1]$ java -jar jedit.jar
[error] java.lang.InternalError: not implemented yet
[error] at sun.awt.X11SurfaceData.getRaster(X11SurfaceData.java:155)
[error] at sun.java2d.loops.OpaqueCopyAnyToArgb.Blit(CustomComponent.java:67)
[error] at sun.java2d.loops.GraphicsPrimitive.convertFrom(GraphicsPrimitive.java:451)
[error] at sun.java2d.loops.MaskBlit$General.MaskBlit(MaskBlit.java:186)
[error] at sun.java2d.loops.Blit$GeneralMaskBlit.Blit(Blit.java:170)
[error] at sun.java2d.pipe.DrawImage.blitSurfaceData(DrawImage.java:658)
[error] at sun.java2d.pipe.DrawImage.renderSurfaceData(DrawImage.java:386)
[error] at sun.java2d.pipe.DrawImage.clipAndRenderSurfaceData(DrawImage.java:364)
[error] at sun.java2d.pipe.DrawImage.copyImage(DrawImage.java:66)
[error] at sun.java2d.pipe.DrawImage.copyImage(DrawImage.java:50)
[error] at sun.java2d.pipe.DrawImage.copyImage(DrawImage.java:749)
[error] at sun.java2d.SunGraphics2D.drawImage(SunGraphics2D.java:2803)
[error] at sun.awt.image.ImageRepresentation.drawToBufImage(ImageRepresentation.java:726)[error] at sun.java2d.pipe.DrawImage.copyImage(DrawImage.java:756)
[error] at sun.java2d.SunGraphics2D.drawImage(SunGraphics2D.java:2803)
[error] at sun.java2d.SunGraphics2D.drawImage(SunGraphics2D.java:2793)
[error] at org.gjt.sp.jedit.gui.SplashScreen.paint(Unknown Source)
[error] at sun.awt.RepaintArea.paint(RepaintArea.java:177)
[error] at sun.awt.motif.MComponentPeer.handleEvent(MComponentPeer.java:374)
[error] at java.awt.Component.dispatchEventImpl(Component.java:3699)
[error] at java.awt.Component.dispatchEvent(Component.java:3480)
[error] at java.awt.EventQueue.dispatchEvent(EventQueue.java:450)
[error] at java.awt.EventDispatc

Hangdog42 05-16-2003 12:12 PM

A couple of questions (sorry if they seem a bit simplistic. I'm not trying to be insulting, I'm just trying to get a better picture)

How did you install Jedit and were there any errors? Were you root when you installed?

Are you running Xwindows when you try to start Jedit (I get errors if I try to start from a plain console, but it works fine if I start it from an Xwindows console)

If you enter which java at the console, is it pointing to the correct directory?

Have ANY java applications (or applets) worked? For example if you write a quick "Hello world" kind of program, will it run?

Your errors look like something is fundamentally wrong with accessing Java. You might want to post the full list and we can see if there are any better clues there.

Marcos Van 05-16-2003 03:50 PM

Thanks for the hlelp Hangdog,

Installing the jdk and jedit had no errors. also note that I have also tried to run other .jar files that I know work in Windows.

I followed the instructions on this link to setup the sdk.
http://members.shaw.ca/trollking/linux.html

when I type "Which Java" I get: /usr/java/j2sdk1.4.1_02/bin/java

I also followed instructions from this thread by Tinkster
http://www.linuxquestions.org/questi...ght=setup+java

the jdk.sh file I have written looks like this:
#!/bin/sh
# Add JDK1.4 specific settings
# please note that your path's might be different! :}
export JAVA_HOME=/usr/java/j2sdk1.4.1_02/
export PATH=$PATH:/usr/java/j2sdk1.4.1_02/bin:/usr/java/j2sdk1.4.1_02/jre/bin
export CLASSPATH=$JAVA_HOME/lib

I'm not sure what you mean by running the java app in an XWindows console.. I'm just opening up one of the included terminals and running the command.

Thanks for all your help!

Marcos

dance2die 05-16-2003 04:22 PM

Hello there my Fellow n00b friend... (I am super fresh too. :)

Anyways, i have installed jedit just to invoke it by just typing "jedit" anywhere on command shell.

You don't have to do this way(i hate changing to root often..)
but what I did was that,

I created "/bin" dir in my $HOME dir. and then I included that $HOME/bin dir to $PATH env var in /etc/bashrc(in my case...)
and then i created a file named "jedit" in $HOME/bin.

Inside the "jedit" file in $HOME/bin, just type in
"$JAVA_HOME/bin/java -jar <your jedit jar path>" without "<>".

I am doing the same for my netbeans and other java utilities...

Hoped that helped... :)

>> sung <<

Hangdog42 05-17-2003 07:43 AM

It looks like you have java installed correctly, so I wonder if the environment variables are goofed up. You have jdk.sh set up properly, but does it ever run? Here is an quick way to tell. At the command prompt type either $PATH or $CLASSPATH and note the directories returned. Now type ./jdk.sh
and then try either the $PATH or $CLASSPATH again and see if there are any changes.

Another possibility is that the Java installation is screwed up. I know diddly about Mandrake or how well it handles rpm packages. As a last resort, you might uninstall the rpm and then install the non-rpm version from Sun.

Marcos Van 05-17-2003 08:05 PM

hmm, I think your on to something Hangdog.. here is what I get when typing $PATH in a console.

[jim@localhost jim]$ $PATH
bash: /usr/java/j2sdk1.4.1_02/bin:/usr//bin:/bin:/usr/bin::/usr/local/bin:/usr/X11R6/bin:/usr/games:/usr/java/j2sdk1.4.1_02/bin:/usr/java/j2sdk1.4.1_02/jre/bin:/home/jim/bin:/usr/java/j2sdk1.4.1_02/bin:/usr/java/j2sdk1.4.1_02/jre/bin: No such file or directory
[jim@localhost jim]$
[jim@localhost jim]$

Notice how it says "no such file or directory".. But what file or directory is it talking about??

Then when I go to type "-/jdk.sh" I get..

[jim@localhost jim]$ -/jdk.sh
bash: -/jdk.sh: No such file or directory
[jim@localhost jim]$

To be honest, I never knew what this jdk.sh was suppose to do or when it was suppose to get executed.

Any more ideas on fixing this? Thanx so much for all the help thus far. Switching to Linux has been an excited yet sometimes frustrating venture..

Marcos

Hangdog42 05-18-2003 09:44 AM

Well, I wouldn't worry about the "no such file or directory" in your first $PATH. Mine does the same thing and I have no problem running java programs. However, you do have your java directories in the path twice. That shouldn't screw things up, but it suggests a couple of scripts are modifying your path. You probably need to find out which ones and check into what else they are doing. The places I would check would be your /etc/profile file (this has a lot of system wide setting) and any of the scripts in the /etc/rc.d directory. However, since I don't use Mandrake, I'm guessing that the /etc/rc.d directory is where Mandrake keeps its startup scripts.

As for the jdk.sh, the reason it didn't run is you used a - (dash) instead of a . (period). You need to be in the directory where you have jdk.sh and then run ./jdk.sh. The file itself is a shell script that sets the JAVA_HOME, PATH and CLASSPATH environment variables. There are a couple of places to look for when it is run. In /etc/rc.d there is a file name rc.local and you should look in there. rc.local is a script that runs every time you boot and it is conceivable that there is a reference to jdk.sh in there. The other place to look is in the hidden files in your home directory. There should be something along the lines of .bash_profile. It contains all the scripts that run whenever you log in as you. By the way, this would be a very good time to learn how to use the grep command. It will make your searching through files a lot easier.

Finally, you might want to try posting the entire error set you get when you try to run jedit. You could try something like java -jar jedit.jar 2> errorfile. The 2> redirects all errors into a file (in this case called errorfile, but you can name it anything). The stuff you posted is what is going wrong. What it isn't showing (and frequently does later in the list) is showing why it is going wrong. That may help diagnose this.

Again, if you are feeling bold, you could try uninstalling the rpm version of java and installing the non-rpm version.

mhearn 05-18-2003 12:50 PM

Try running this first:

export LD_ASSUME_KERNEL=2.2.5

Marcos Van 05-20-2003 09:23 PM

Well, I uninstalled the .rpm and reinstalled the binary file from Sun. The results are the same..

I'm starting to think that the java SDK really is installed correctly and something else is not happy. You mentioned above that you have problems running java apps in the console but they work when you use "xconsole". Could you please elaborate on how you execute .jar files?
I did a 'man xconsole' in the shell, but it seems to say that xconsole is used for capturing output from applications.

hmm.. I really have to wonder why Sun couldn't of just had a script in their install that did the configurations automatically.. Coming from a Windows world, this is something I guess I've come to take for granted ;)

I'm still sticking with Linux NO MATTER WHAT! ;)

Thanx

Marcos

Hangdog42 05-20-2003 10:07 PM

Quote:

You mentioned above that you have problems running java apps in the console but they work when you use "xconsole".
Actually, I was specifically referring to Jedit here, I can run plain text java apps in the console without a problem. About 50% of the time, I don't have a graphical environment running, I'm just using the text console. If I try to start Jedit from the text console, it doesn't work because it needs a graphical environment to run. However, if I fire up Fluxbox, then start a graphical terminal (like xterm or aterm) and start Jedit from there, it works fine. If you are always working in KDE, then my question doesn't apply since KDE will definitly handle the graphics for Jedit.

I can start Jedit either by just jedit or by moving into the directory with jedit.jar and typing java -jar jedit.jar . I can run pretty much any .jar file by using java -jar filename.jar.

At this point, I'm pretty much out of ideas. The only thing I can think of is for you to post the entire set of errors you get when you try to run a jar file, there may be a clue there.

Marcos Van 05-20-2003 10:36 PM

Well, thanks for all your help so far. Even though it's not resolved, I'm sure I am learning something about Linux while doing all this.

I'm trying to paste the console output in this forum but I think it is exceeding the max character limit. If I figure this out I wil post it.

Thanks again. If I do somehow get this resolved, I will post here in case someone else experiences the same difficulties.

Marcos.


All times are GMT -5. The time now is 08:15 PM.