Java in Linux

Can I use Gtk components in my java applications?

I tried to install java in linux. But I had lots of problems. So I decided to do this with a plan. Because I have to install lots of things or I made it hard for me.

What shall I install and in which queue shall I install them? (JDK, JRE, Java studio or netbeans...)

Thanks for any help...

[364 byte] By [Genomsarena] at [2007-11-27 9:35:19]
# 1
I don't know for certain since I've never installed it on linux before, but you should only have to install the jdk and you'll be set.
hunter9000a at 2007-7-12 23:02:07 > top of Java-index,Java Essentials,New To Java...
# 2
There should be a linux binary ... download that, chmod 7xx, and run it. It will take care of everything else itself. You shouldn't have to build it.
Navy_Codera at 2007-7-12 23:02:07 > top of Java-index,Java Essentials,New To Java...
# 3
https://sdlc2a.sun.com/ECom/EComActionServlet;jsessionid=98FC659EF67608379237786D04F04175Select "Linux self-extracting file." (Click on the link, not the checkbox... I hate that mess.)
Navy_Codera at 2007-7-12 23:02:07 > top of Java-index,Java Essentials,New To Java...
# 4

Here's a helpful page about system configurations if you are downloading Java 5. I've got Java 5 running on RHEL version 4 right now.

http://java.sun.com/j2se/1.5.0/system-configurations.html

Here are the installation notes for linux. There's a review of how to install both the self extracting binary and the rpm file.

http://java.sun.com/j2se/1.5.0/install-linux.html

nantucketa at 2007-7-12 23:02:07 > top of Java-index,Java Essentials,New To Java...
# 5
thanks very much... And can I use linux's textboxes, labels, chackboxes etc. in java?Message was edited by: Genomsaren
Genomsarena at 2007-7-12 23:02:07 > top of Java-index,Java Essentials,New To Java...
# 6

> thanks very much... And can I use linux's textboxes,

> labels, chackboxes etc. in java?

>

> Message was edited by:

> Genomsaren

Sort of ... you can use AWT which will take the "native widgets." You can also use:

com.sun.java.swing.plaf.gtk.GTKLookAndFeel

Navy_Codera at 2007-7-12 23:02:07 > top of Java-index,Java Essentials,New To Java...
# 7

> And can I use linux's textboxes, labels, chackboxes etc. in java?

Well, I guess they're GTK's widgets you are talking about, not Linux's ...;) But, yes, according to these people: http://java-gnome.sourceforge.net/ "Since 1998, the java-gnome project has been offering Java bindings for the GTK widget toolkit and for the rich family of libraries making up the GNOME desktop."

Meanwhile the little white angel figure waggles its finger and cautions:

-- I've never used this software

-- If you're new to Java, consider that it has a *big* API: that means lots of widgets and things to learn. If you add to this the task of learning to communicate between this language and another, this is looking like a lot of work. At least learn the language first!

-- Using JNI (ie communicating at a low level with the OS) which this approach involves, may be a case of banging like h3ll on a square peg to force it into a round hole. At a minimum you lose OS independency (the freedom for your software to run on any* OS).

But who listens to the little white angel figure? Good luck!

* where any==possessing a jre; but note how I've dragged freedom into it!

pbrockway2a at 2007-7-12 23:02:07 > top of Java-index,Java Essentials,New To Java...
# 8

When I try to install this: jstudio_ent81-ml-linux.sh

I get this error: No compatible Java SE Runtime Environment (JRE) was found on this system.

But Before I have downloaded and installed following files:

jre-6u1-linux-i586.bin and jdk-6u1-linux-i586.bin

Where is the problem?

Genomsarena at 2007-7-12 23:02:07 > top of Java-index,Java Essentials,New To Java...
# 9

The jdk includes the jre. So you only need to install the jdk.

You might need to update your PATH variable to include the path to the bin directory of the jdk installation.

Try launching a shell and entering java -version

and notice the output.

When you ran the bin file did you do so as root?

Back in the shell try ls -l /usr/java

and notice the output.

Also "echo $PATH" and verify that the jdk bin directory like /usr/java/jdk1.6.0_01/bin

or something is included in your PATH output. The actual jdk directory will depend upon the version you've installed.

nantucketa at 2007-7-12 23:02:07 > top of Java-index,Java Essentials,New To Java...
# 10

the same folder was on my desktop it extracted it to my desktop during the installation

i think that was because of my rights. i copied that folder as root to usr java directory. and there wasnt any java dir there i made it myself. but still i cant install java studio and i still get the same error :(

Genomsarena at 2007-7-12 23:02:07 > top of Java-index,Java Essentials,New To Java...
# 11

Okay you will need to update your PATH variable then.

If you are the only user on the system then you can place the installation directory inside your home directory. Having it inside /usr allows other users to use java.

Assuming you are the only user, you can append the PATH variable using your .bash_profile file inside your home directory.

cd ~

vi .bash_profile

Now add the bin directory to the PATH variable - whatever it may be for you.

PATH=$PATH:/usr/java/jdk6/bin

export PATH

At this point you can either log out and log back in again or simply enter

source .bash_profile

in the shell. Then enterjava -version

And you should see a reference to Java 6 there.

nantucketa at 2007-7-12 23:02:07 > top of Java-index,Java Essentials,New To Java...
# 12

I get this reference:

java version "1.4.2"

gij (GNU libgcj) version 4.1.2 (Ubuntu 4.1.2-0ubuntu5)

Copyright (C) 2006 Free Software Foundation, Inc.

This is free software; see the source for copying conditions. There is NO

warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

And this is my bash profile:

# ~/.bash_profile: executed by bash(1) for login shells.

# see /usr/share/doc/bash/examples/startup-files for examples.

# the files are located in the bash-doc package.

# the default umask is set in /etc/login.defs

#umask 022

# include .bashrc if it exists

if [ -f ~/.bashrc ]; then

. ~/.bashrc

fi

# set PATH so it includes user's private bin if it exists

if [ -d ~/bin ] ; then

PATH=~/bin:"${PATH}"

PATH=$PATH:/usr/java/jdk1.6.0_01/bin

export PATH

fi

Genomsarena at 2007-7-12 23:02:07 > top of Java-index,Java Essentials,New To Java...
# 13
> java version "1.4.2"> gij (GNU libgcj) version 4.1.2 (Ubuntu 4.1.2-0ubuntu5)Did you mean to use this or rather a SUN-supplied one maybe?
BIJ001a at 2007-7-12 23:02:07 > top of Java-index,Java Essentials,New To Java...
# 14
no if I type java -version I get that reference and I wanted to show my .bash_porfile file maybe this helps you to help me :) Because still java studio cant see my JRE.
Genomsarena at 2007-7-12 23:02:07 > top of Java-index,Java Essentials,New To Java...
# 15

I have downloaded the JDK package with netbeans. I tried to install it but this time I got this error:

WARNING: cannot instantiate string resolver method com.installshield.util.LocalizedStringResolver: com.installshield.database.ISSqlException: Table already exists: EVENT in statement [CREATE TABLE Event(Event VARCHAR(255) NOT NULL PRIMARY KEY,EventText VARCHAR(255) NOT NULL,ActionSequence_ INTEGER)] [ CREATE TABLE Event(Event VARCHAR(255) NOT NULL PRIMARY KEY,EventText VARCHAR(255) NOT NULL,ActionSequence_ INTEGER)] caused by: java.sql.SQLException: Table already exists: EVENT in statement [CREATE TABLE Event(Event VARCHAR(255) NOT NULL PRIMARY KEY,EventText VARCHAR(255) NOT NULL,ActionSequence_ INTEGER)]

Table already exists: EVENT in statement [CREATE TABLE Event(Event VARCHAR(255) NOT NULL PRIMARY KEY,EventText VARCHAR(255) NOT NULL,ActionSequence_ INTEGER)] [ CREATE TABLE Event(Event VARCHAR(255) NOT NULL PRIMARY KEY,EventText VARCHAR(255) NOT NULL,ActionSequence_ INTEGER)] caused by: java.sql.SQLException: Table already exists: EVENT in statement [CREATE TABLE Event(Event VARCHAR(255) NOT NULL PRIMARY KEY,EventText VARCHAR(255) NOT NULL,ActionSequence_ INTEGER)]WARNING: could not delete temporary file /tmp/ismp001/6843623

WARNING: could not delete temporary file /tmp/ismp001/225707

WARNING: could not delete temporary file /tmp/ismp001/3907936

(I tried this with root)

Genomsarena at 2007-7-21 23:03:52 > top of Java-index,Java Essentials,New To Java...
# 16

> I get this reference:

> java version "1.4.2"

> gij (GNU libgcj) version 4.1.2 (Ubuntu

> 4.1.2-0ubuntu5)

>

> Copyright (C) 2006 Free Software Foundation, Inc.

> This is free software; see the source for copying

> conditions. There is NO

> warranty; not even for MERCHANTABILITY or FITNESS FOR

> A PARTICULAR PURPOSE.

>

Your Ubuntu distro contains a previously installed open source version of Java. I've never used another version of Java, only the Java versions available from Sun. So I recommend using Java from Sun. Open a shell and trysudo update-alternatives --config java

http://www.linuxquestions.org/questions/showthread.php?t=555994&highlight=Java+Ubuntu

http://blog.agileware.net/index.php/archives/2005/09/30/how-to-install-java-on-ubuntu-linux/

https://help.ubuntu.com/community/Java#head-fef9352fb26820bb774df978180c9dd3a60e777b

nantucketa at 2007-7-21 23:03:52 > top of Java-index,Java Essentials,New To Java...
# 17

I did as you said. Now I get this reference from "java -version":

java version "1.6.0"

Java(TM) SE Runtime Environment (build 1.6.0-b105)

Java HotSpot(TM) Client VM (build 1.6.0-b105, mixed mode, sharing)

But still I cant install jstudio:

No compatible Java SE Runtime Environment (JRE) was found on this system.

and I can not install netbeans too:

WARNING: cannot instantiate string resolver method com.installshield.util.LocalizedStringResolver: com.installshield.database.ISSqlException: Table already exists: EVENT in statement [CREATE TABLE Event(Event VARCHAR(255) NOT NULL PRIMARY KEY,EventText VARCHAR(255) NOT NULL,ActionSequence_ INTEGER)] [ CREATE TABLE Event(Event VARCHAR(255) NOT NULL PRIMARY KEY,EventText VARCHAR(255) NOT NULL,ActionSequence_ INTEGER)] caused by: java.sql.SQLException: Table already exists: EVENT in statement [CREATE TABLE Event(Event VARCHAR(255) NOT NULL PRIMARY KEY,EventText VARCHAR(255) NOT NULL,ActionSequence_ INTEGER)]

Table already exists: EVENT in statement [CREATE TABLE Event(Event VARCHAR(255) NOT NULL PRIMARY KEY,EventText VARCHAR(255) NOT NULL,ActionSequence_ INTEGER)] [ CREATE TABLE Event(Event VARCHAR(255) NOT NULL PRIMARY KEY,EventText VARCHAR(255) NOT NULL,ActionSequence_ INTEGER)] caused by: java.sql.SQLException: Table already exists: EVENT in statement [CREATE TABLE Event(Event VARCHAR(255) NOT NULL PRIMARY KEY,EventText VARCHAR(255) NOT NULL,ActionSequence_ INTEGER)]WARNING: could not delete temporary file /tmp/ismp001/4609323

WARNING: could not delete temporary file /tmp/ismp001/3997976

WARNING: could not delete temporary file /tmp/ismp001/5649000

And I dont get it why are errors containning SQL sentences?

Genomsarena at 2007-7-21 23:03:52 > top of Java-index,Java Essentials,New To Java...
# 18

> I did as you said. Now I get this reference from

> "java -version":

> java version "1.6.0"

> Java(TM) SE Runtime Environment (build 1.6.0-b105)

> Java HotSpot(TM) Client VM (build 1.6.0-b105, mixed

> mode, sharing)

Okay good. So it's on the Path.

> But still I cant install jstudio:

>

> No compatible Java SE Runtime Environment (JRE) was

> found on this system.

Hm.

You may be attempting to install Java Studio as root, but root will wish to use the system wide PATH variable, rather than that of your user account. So you may need to update the system PATH by su root and editing the file /etc/profile just as you did for your .bash_profile file.

PATH=$PATH:....

export PATH

However, note that I looked quickly at this

http://docs.sun.com/source/819-8012/chap_sol_installing.html#95212

and noticed that administrator privileges are not necessary to install Java Studio on Linux. So you may try to install Java Studio as your user account rather than as root.

nantucketa at 2007-7-21 23:03:52 > top of Java-index,Java Essentials,New To Java...
# 19
No it doesnt work.I want to uninstall everything and do it "nicely". With a plan. Is there any way to uninstall all java versions? And then Ill try to install jdk with netbeans.
Genomsarena at 2007-7-21 23:03:52 > top of Java-index,Java Essentials,New To Java...
# 20

I use Red Hat, not Ubuntu. My java install was a lot easier than this. So I'll just recommend you use Google, and Linux Questions www.linuxquestions.org and maybe some one who uses ubuntu will stop by and help you out if you continue to have trouble.

In the meantime, use Google. That's how I found this link.

http://ubuntuforums.org/showthread.php?t=76702

Copied from the preceding link -

"How to install Sun's Java"

Since I haven't seen any how to's on how to install Sun's java (Any Version) I thought I'd write up a little how to.

First you will need to add all the extra repositories for Ubuntu. (ie Multiverse, Universe...) Please see other how to's on how to do that.

Now go to Sun's website http://java.sun.com and select the java jdk or jre that you want. In my case I needed 1.4.2 so I downloaded j2sdk-1_4_2_09-linux-i586.bin.

Then run the following commands from the terminal:

First install the required packages:

sudo apt-get install fakeroot java-package java-common

Create the Deb file for the install:

fakeroot make-jpkg jre-1_5_0_05-linux-i586.bin

Install The deb file

sudo dpkg -i sun-j2re1.5_1.5.0+update05_i386.deb

Now make Sun's java the default by running this command and selecting it.

sudo update-alternatives --config java

Good luck.

nantucketa at 2007-7-21 23:03:52 > top of Java-index,Java Essentials,New To Java...
# 21
Thanks very much nantucket. You helped me a lot...
Genomsarena at 2007-7-21 23:03:52 > top of Java-index,Java Essentials,New To Java...
# 22
You're welcome.
nantucketa at 2007-7-21 23:03:52 > top of Java-index,Java Essentials,New To Java...
# 23
I am a newbie to Ubuntu and I am trying to get Java into my path but I do not know what path to add. When I run java -version I get the following:java version "1.4.2"gij (GNU libgcj) version 4.1.2 (Ubuntu 4.1.2-0ubuntu5)How do I modify my path statement?
n5paa at 2007-7-21 23:03:52 > top of Java-index,Java Essentials,New To Java...