32 bit compiled Java Program not connecting to 64 bit Oracle 11g

Hi,
I am using one java program to connect to Oracle 11g (64 bit version) using Oracle10g 32 bit client libraries using OCI calls. Below is the program. If I compile it using 64 bit Oracle 10g libraries ($ORACLE_HOME/lib and $ORACLE_HOME/rdbms/lib) , it perfectly connects to Oracle11g but when i compile it using $ORACLE_HOME/lib32 and $ORACLE_HOME/rdbms/lib32, it hangs and keeps trying and takes 100% cpu usage. it does nothing. Please suggest what is going wrong in the environment.
============================
import java.sql.*;
class dbAccess {
public static void main (String args []) throws Exception
Class.forName ("oracle.jdbc.OracleDriver");
Connection conn = DriverManager.getConnection
("jdbc:oracle:oci8:@lvfd", "fde", "fde");
// or oci7 @TNSNames_Entry, userid, password
try {
Statement stmt = conn.createStatement();
try {
ResultSet rset = stmt.executeQuery("select * from tab");
try {
while (rset.next())
System.out.println (rset.getString(1)); // Print col 1
} finally {
try { rset.close(); } catch (Exception ignore) {}
} finally {
try { stmt.close(); } catch (Exception ignore) {}
} finally {
try { conn.close(); } catch (Exception ignore) {}
================================================

>
I am compiling like when LD_LIBRARY_PATH set to $ORACLE_HOME/lib32:$ORACLE_HOME/rdbms/lib32.
javac -cp .:$ORACLE_HOME/jdbc/lib/ojdbc14.jar dbAccess.java
as my program resides in current directory. I run it like :
java -cp .:$ORACLE_HOME/jdbc/lib/ojdbc14.jar dbAccess
Output: it hangs forever.
I am compiling like when LD_LIBRARY_PATH set to $ORACLE_HOME/lib:$ORACLE_HOME/rdbms/lib
javac -cp .:$ORACLE_HOME/jdbc/lib/ojdbc14.jar dbAccess.java
as my program resides in current directory. I run it like :
java -cp .:$ORACLE_HOME/jdbc/lib/ojdbc14.jar dbAccess
Output: It gets connected and list all the tables as output.
>
The ojdbc14.jar file is for use with Java 1.4 VMs.
Are you still using Java 1.4? If so, why?
For Oracle 11g you should be using the latest JDBC jar file (ojdbc6.jar) and the latest version of Java 1.6.
You are not only using an old JDBC driver and Java version but are also trying to mix 32 bit and 64 bit operations.
I suggest you start using recommended practices and update your Java and JDBC versions and select EITHER 32 bit or 64 bit operations.
See the Official JDBC FAQ for the details on the support available for various combinations of Oracle DB, Java and the JDBC drivers:
http://www.oracle.com/technetwork/database/enterprise-edition/jdbc-faq-090281.html

Similar Messages

  • Java Mail throws Connect failed error in Oracle 11g Enterprise  Edition

    Hi,
    I am using Oracle 11g Enterprise edition.I have a java class which is used for reading outlook 2010 inbox and download attachments from mails .For Connecting to OutLook from oracle i am using "POP3S" protocol in my java class. Which is working fine until my database is oracle-11g standard edition. Last week we are upgraded our database from oracle 11g standard edition to oracle 11g enterprise edition after that i can't connect to mail server through my java class which throws an error as follows.
    DEBUG: setDebug: JavaMail version 1.4.4
    DEBUG: getProvider() returning javax.mail.Provider[STORE,pop3s,com.sun.mail.pop3.POP3SSLStore,Sun Microsystems, Inc]
    DEBUG POP3: mail.pop3s.rsetbeforequit: false
    DEBUG POP3: mail.pop3s.disabletop: false
    DEBUG POP3: mail.pop3s.forgettopheaders: false
    DEBUG POP3: mail.pop3s.cachewriteto: false
    DEBUG POP3: mail.pop3s.filecache.enable: false
    DEBUG POP3: mail.pop3s.keepmessagecontent: false
    DEBUG POP3: mail.pop3s.starttls.enable: true
    DEBUG POP3: mail.pop3s.starttls.required: false
    DEBUG POP3: mail.pop3s.apop.enable: false
    DEBUG POP3: mail.pop3s.disablecapa: false
    DEBUG POP3: connecting to host "194.42.133.180", port 110, isSSL true
    javax.mail.MessagingException: Connect failed;
    nested exception is:
         javax.net.ssl.SSLException: Unrecognized SSL message, plaintext connection?
         at com.sun.mail.pop3.POP3Store.protocolConnect(POP3Store.java:210)
         at javax.mail.Service.connect(Service.java:295)
         at javax.mail.Service.connect(Service.java:176)
         at GetNoonReport.Connect2Mailserver(GetNoonReport:338)
         at GetNoonReport.ReadMail(GetNoonReport:103)
    Caused by: javax.net.ssl.SSLException: Unrecognized SSL message, plaintext connection?
         at com.sun.net.ssl.internal.ssl.InputRecord.handleUnknownRecord(InputRecord.java:501)
         at com.sun.net.ssl.internal.ssl.InputRecord.read(InputRecord.java)
         at com.sun.net.ssl.internal.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java)
         at com.sun.net.ssl.internal.ssl.SSLSocketImpl.performInitialHandshake(SSLSocketImpl.java:1025)
         at com.sun.net.ssl.internal.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1038)
         at com.sun.mail.util.SocketFetcher.configureSSLSocket(SocketFetcher.java:507)
         at com.sun.mail.util.SocketFetcher.getSocket(SocketFetcher.java:238)
         at com.sun.mail.pop3.Protocol.<init>(Protocol.java:107)
         at com.sun.mail.pop3.POP3Store.getPort(POP3Store.java:261)
         at com.sun.mail.pop3.POP3Store.protocolConnect(POP3Store.java:206)
         ... 4 more
    Is Oracle Enterprise Edition supports "POP3S" protocol?, Or Enterprise edition needs any additional configuration for establishing outlook connection with "pop3s" ?.
    Any help is appreciated
    Regards ,
    Nisanth

    907833 wrote:
    Hi,
    I am using Oracle 11g Enterprise edition.I have a java class which is used for reading outlook 2010 inbox and download attachments from mails .For Connecting to OutLook from oracle i am using "POP3S" protocol in my java class. Which is working fine until my database is oracle-11g standard edition. Last week we are upgraded our database from oracle 11g standard edition to oracle 11g enterprise edition after that i can't connect to mail server through my java class which throws an error as follows.
    I suspect root cause is with Java not Oracle.
    Oracle RDBMS does NOT speak any "protocol" except SQL natively.

  • How to compile java programs in j2EE 1.4 SDK

    hi,
    i HAVE JUST INSTALLED NEW J2EE 1.4 SDK , IT HAS BEED INSTALLED SUCCESFULLY BUT I AM UNABLE TO COMPILE JAVA PROGRAMS WHICH I USED TO RUN IN SDK 1.4 ,OR EVEN NEW WRITTEN EXAMPLES. CAN ANYONE PLZ HELP ME.

    J2EE by itself is not capable of compiling Java. It requires that a J2SDK be installed first - this is what compiles and runs Java programs. Did you install the combination J2SDK and J2EE, or just the J2EE?
    If both are installed, then you should be able to compile and run as you used to..

  • Compiling Java Program thro EXEC

    hi..
    I want to compile java programs programatically. I am using exec for that. The problem is there is a error in the i am no getting any message from that Process .will u help me how to solve this
    URGENT
    pyari
    Code Snippet
              try
                                  String command = "cmd /c javac -classpath c:\\j2ee\\home\\ejb.jar -d "+
                                  "c:\\javapr~1\\WeblogicEJBComplier\\tempBuild "+
                                  "C:\\j2ee\\home\\demo\\ejb\\cart\\CartClient.java";
         System.out.println(command);
         Runtime rnt = Runtime.getRuntime();
                                  Process prs = rnt.exec(command);
                                  BufferedReader bfr = new BufferedReader(new InputStreamReader(prs.getInputStream()));
                                  String str = bfr.readLine();
                                  System.out.println(str);
                                  while(str!=null)
                                       System.out.println(str) ;
                                       str = bfr.readLine();
              }catch(Exception eo)
                   System.err.println(eo);

    javac writes the errors in stderr, not in stdout.
    So replace getInputStream() with getErrorStream()...

  • HELP for Compile java programe !

    Hello All,
    i want to make java programe by which i can compile java programes
    and when i compile java programe from my programe then
    i shoul get compiled status means programe compile successfuly
    or not compile.
    if any example i m thanksfull.
    onlyforjava.

    how about if compile fail?
    the process obj seems return value 0 as it run successful.
    I haven't try this, but I have experienced the process obj returns 0 if the executed command has some routine to handle error cases, in which, error will not halt the system.
    So, I recommand the following scenario.
    1. let say, if your java is test.java. check the existence of file test.class.
    If, it exists, get its modified time.
    2. compile the java code with
    Procress p = Runtime.exec(new String[]{"javac", "test.java"});
    3. get the error string if any.
    InputStream in = new BufferedInputStream(p.getInputStream());int read;while ((read = in.read()) != -1){  System.out.println((char)read);}
    4. handle error with the exitValue
    if (p.exitValue() != 0){  System.out.println("warning.");}
    5. check again the file test.class if it is a newly created file.
    6. if it is newly created, compile success. Else, failed.

  • Can't connect to MySQL from Oracle 11g R1

    Hello Oracle's guru.
    Sorry for my English it's not my native langauge
    Enviroments: Oracle 11g R1, Windows 7, ODBC Driver 5.1.8
    I have a some problem with creation gateway to connection to MySQL, and I hope somebody can help me.
    So,
    1) ODBC name - MYSQLDSN
    2) initMYSQLDSN.ora
    # This is a sample agent init file that contains the HS parameters that are
    # needed for the Database Gateway for ODBC
    # HS init parameters
    HS_FDS_CONNECT_INFO = MYSQLDSN
    HS_FDS_TRACE_LEVEL = 0
    3) listener.ora
    # listener.ora Network Configuration File: E:\app\voxa\product\11.1.0\db_1\network\admin\listener.ora
    # Generated by Oracle configuration tools.
    LISTENER =
    (DESCRIPTION_LIST =
    (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = 0.0.0.0)(PORT = 1521))
    (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
    SID_LIST_LISTENER=
    (SID_LIST=
    (SID_DESC=
    (SID_NAME=MYSQLDSN)
    (ORACLE_HOME=E:\app\voxa\product\11.1.0\db_1)
    (PROGRAM=dg4odbc)
    4) tnsnames.ora
    # tnsnames.ora Network Configuration File: E:\app\voxa\product\11.1.0\db_1\network\admin\tnsnames.ora
    # Generated by Oracle configuration tools.
    CXWH =
    (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = 0.0.0.0)(PORT = 1521))
    (CONNECT_DATA =
    (SERVER = DEDICATED)
    (SERVICE_NAME = CXWH)
    MYSQLDSN =
    (DESCRIPTION =
    (ADDRESS_LIST =
    (ADDRESS = (PROTOCOL = TCP)(HOST = 0.0.0.0)(PORT = 1521))
    (CONNECT_DATA =(SID = MYSQLDSN))
    (HS = OK)
    Then I trying to connect to MySQL using sql*plus:
    C:\Windows\system32>sqlplus
    SQL*Plus: Release 11.1.0.6.0 - Production on Ср Июн 1 12:13:39 2011
    Copyright (c) 1982, 2007, Oracle. All rights reserved.
    login: system
    pass:
    Connect to:
    Oracle Database 11g Enterprise Edition Release 11.1.0.6.0 - Production
    With the Partitioning, OLAP, Data Mining and Real Application Testing options
    SQL> create public database link MYSQLDSN
    2 connect to DEMO identified by "DEMO" using 'MYSQLDSN';
    Channel was created
    SQL> select * from items@MYSQLDSN;
    select * from items@MYSQLDSN
    Error in line 1:
    ORA-28500: connection with ORACLE with other system return message:
    [MySQL][ODBC 5.1 Driver][mysqld-5.5.12]You have an error in your SQL syntax;
    check the manual that corresponds to your MySQL server version for the right
    syntax to use near
    '"ITEMS_KEY",A1."ITEM_NAME",A1."ITEM_CATEGORY",A1."ITEM_VENDOR",A1."ITEM_SKU",A1
    .' at line 1
    ORA-02063: предшествующий 2 lines из MYSQLDSN
    If I trying create new ODBC mobule via OWB, I had next error:
    [MySQL][ODBC 5.1 Driver][mysqld-5.5.12]You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '"DUAL"' at line 1
    ORA-02063: предшествующий 2 lines из OWB_56
    What I do wrong? Please help me

    Hi,
    You can download the 11.1.0.7 patchset from My Oracle Support -
    support.oracle.com
    as patch 6890831.
    Once logged in click on 'Patches and Updates' and enter the patch number as 6890831 and choose whichever platform you are running.
    the readme explains how to apply the patch to an existing 11.1.0.6 install.
    The url you posted is only for complete product installs, but 11.1.0.7 is only a patchset that must be applied to an existing install.
    Regards,
    Mike

  • Table space not reduce after delete in oracle 11G

    Hi Team,
    I have a DB 11.1.0.7 on unix.
    I have execute delete tables on tablespace, but this not reduce.
    Thanks

    935299 wrote:
    What segment space management type is defined for the tablespace in question?
    MANUAL
    Then you should check out the documentation some more.
    But even if you shrink the table segement what is that going to do for the data file size?
    I don't undertand you.
    ThanksYour thread is titled "Table space not reduce after delete in oracle 11G" which implies to me that you are interested in reducing the size of a tablespace (which really means reducing the size of the underlying datafile(s)).
    So, if you shrink the size of the sys.aud$ table, will that cause the datafile(s) to become smaller? Will it accomplish your goal? What else, if anything, needs to happen?

  • Not able to compile java program

    Hi
       I a using Netweaver to deelope the java code.I have written a javaprogram .But when choose the option Run as
    a javaApplication it giving the following error
    Source locator  doesnot Exist:org.eclipse.jdt.debug.ui.javaSourceLocator

    Hi,
    I am able to compile and run perfectly Java programs. The steps goes as:
    1. File --> New --> Project --> Java --> Java Project --> give a <project name> --> Finish
    2. File --> New --> Class --> give a classname, and package name.
    3. Put main method and give a System.out.println("Hello");
    Source code:
    package com.i3l.trg;
    public class HelloWorld {
         public static void main(String[] args)      {
              System.out.println("Hello");          
    4.Goto Run --> Run As --> 2 Java Application.
    5. You will get a output as "Hello" in java console.
    Cheers!!!
    Sukanta Rudra
    PS: Liberally donate points.
    The full source code is

  • How to compile java programs? There is no javac for me!

    Hi, I'm starting to learn java and downloaded the java 1.4.0.1 standard edition from this website. However, after I installed the program, there is no javac to be found while there is a java.exe. I need javac to compile my program before I can interpret it but it is nowhere to be found!
    Did I download the wrong SDK version? I thank anyone in advance who can help me in the right direction!

    You must have the SDK to create programs. The Jre is a component of the SDK that can be downloaded separately if you only want to run programs.
    SDK downloads from here, use the row "Windows (all languages, including English)" and be sure to select the SDK COLUMN, not the JRE:
    http://java.sun.com/j2se/1.4/download.html

  • Java program not running by the Ant

    i have a small java program.
    its a classpath problem.
    cant figure out where is the problem.
    i am running the code via Ant.
    build.xml
    <?xml version="1.0"?>
    <project name="myproject" basedir="." default="all">
        <property name="src.dir"     value="src"/>
         <property name="classes.dir" value="classes"/>
         <property name="lib.dir"     value="C:/tomcat/webapps/axis/WEB-INF/lib"/>
         <property name="runclass" value="TestClient"/>
         <target name="all" depends="clean,compile"/>
         <target name="clean">
            <delete dir="${classes.dir}"/>
        </target>
        <path id="classpath">
            <fileset dir="${lib.dir}" includes="**/*.jar"/>
        </path>
        <target name="compile">
            <mkdir dir="${classes.dir}"/>
         <javac srcdir="${src.dir}"
          destdir="${classes.dir}"
          deprecation="on"
          debug="on">
       <classpath><path refid="classpath"/></classpath>
      </javac>
         </target>
         <target name="run" depends="compile">
       <!-- run the class -->
       <java classname="${runclass}">
            <classpath>
              <pathelement path="${classpath}"/>
              <fileset dir="${lib.dir}">
                <include name="**/*.jar"/>
            </fileset>
              </classpath>
           </java>
      </target>
         </project>i invoked
    ant runand got this
    Buildfile: build.xml
    compile:
    run:
         [java] Could not find TestClient. Make sure you have it in your classpath
         [java]     at org.apache.tools.ant.taskdefs.ExecuteJava.execute(ExecuteJava
    .java:170)
         [java]     at org.apache.tools.ant.taskdefs.Java.run(Java.java:710)
         [java]     at org.apache.tools.ant.taskdefs.Java.executeJava(Java.java:178)
         [java]     at org.apache.tools.ant.taskdefs.Java.execute(Java.java:84)
         [java]     at org.apache.tools.ant.UnknownElement.execute(UnknownElement.ja
    va:275)
         [java]     at org.apache.tools.ant.Task.perform(Task.java:364)
         [java]     at org.apache.tools.ant.Target.execute(Target.java:341)
         [java]     at org.apache.tools.ant.Target.performTasks(Target.java:369)
         [java]     at org.apache.tools.ant.Project.executeSortedTargets(Project.jav
    a:1216)
         [java]     at org.apache.tools.ant.Project.executeTarget(Project.java:1185)
         [java]     at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(De
    faultExecutor.java:40)
         [java]     at org.apache.tools.ant.Project.executeTargets(Project.java:1068
         [java]     at org.apache.tools.ant.Main.runBuild(Main.java:668)
         [java]     at org.apache.tools.ant.Main.startAnt(Main.java:187)
         [java]     at org.apache.tools.ant.launch.Launcher.run(Launcher.java:246)
         [java]     at org.apache.tools.ant.launch.Launcher.main(Launcher.java:67)
    BUILD SUCCESSFUL
    Total time: 2 secondsso, code is not running......its dfinitely a classpath problem , because error message says "Could not find TestClient. Make sure you have it in your classpat".
    TestClient is the name of main class file.
    not sure whats wrong with this build.xml ? whats wrong in it ?
    one thing , i guess, i did not mention "." , current directory in the build.xml ......is it because of that ?
    i browsed apache manual......To Run a Java program.....first, they are making a JAR file ...and then they are executing the JAR.
    i really, dont need the JAR file......i just want to run it.....thats enough.
    somewhere, i have to do some modification in this buld.xml.......do you have any idea ?
    thank you

    TestClient folder has
    1)src
    2)classes
    3)build.xml
    i have posted the build.xml already.
    now, src folder has TestClient.java
    TestClient.java
    ==================
    import org.apache.axis.client.Call;
    import org.apache.axis.client.Service;
    import javax.xml.namespace.QName;
    public class TestClient {
       public static void main(String [] args) {
         try {
           String endpoint =
               "http://ws.apache.org:5049/axis/services/echo";
           Service  service = new Service();
           Call     call    = (Call) service.createCall();
           call.setTargetEndpointAddress( new java.net.URL(endpoint) );
           call.setOperationName(new QName("http://soapinterop.org/","echoString"));
           String ret = (String) call.invoke( new Object[] { "Hello!" } );
           System.out.println("Sent 'Hello!', got '" + ret + "'");
         } catch (Exception e) {
           System.err.println(e.toString());
    }and i did
    ant runand i got those errors.
    clearly, its not able to run it.
    looked the manual....did not find anything special about java task....still not working.

  • Error compiling Java Program

    I am new to java programming.
    I recently took a java class. In the lab we created a simple program.
    The program was split up in two separate files.
    //Vehicle.java
    public class Vehicle {
         private double load;
         private double maxLoad;
              public Vehicle(double max_Load) {
                   load = 0.0;     
                   maxLoad = max_Load;
              public double getLoad(){
                   return load;
              public double getMaxLoad(){
                   return maxLoad;
              boolean addBox(double weight) {
                   if ((weight + load) > maxLoad)
                        return false;
                   else
                        load=weight+load;     
                        return true;
    }//end of class Vehicle
    on a complete separate file
    public class TestVehicle {
    public static void main(String[] args) {
    // Create a vehicle that can handle 10,000 kilograms weight
    System.out.println("Creating a vehicle with a 10,000kg maximum load.");
    Vehicle vehicle = new Vehicle(10000.0);
    // Add a few boxes
    System.out.println("Add box #1 (500kg) : " + vehicle.addBox(500.0));
    System.out.println("Add box #2 (250kg) : " + vehicle.addBox(250.0));
    System.out.println("Add box #3 (5000kg) : " + vehicle.addBox(5000.0));
    System.out.println("Add box #4 (4000kg) : " + vehicle.addBox(4000.0));
    System.out.println("Add box #5 (300kg) : " + vehicle.addBox(300.0));
    // Print out the final vehicle load
    System.out.println("Vehicle load is " + vehicle.getLoad() + " kg");
    when we complied the program we ONLY compiled TestVechile.java
    ( javac TestVechile.java) and BOTH the class compiled successfully. When I tried to compile the TestVehicle class at home I got an error at line 6 in TestVehicle.java.
    Please any help would be greatly appreciated.
    - Alex

    To compile TestVehicle.java, you need either Vehicle.java or Vehicle.class -- with neither of them, the compiler doesn't know whether "new Vehicle(10000.0)" is legal or not.

  • Java Program Not Running

    Hi,
    I have a small Java program that imports Oracle.sql.* and Oracle.jdbc.*.
    It establishes a default connection and converts a String[ ] to Oracle.sql.ARRAY type.
    As per Oracle documentation, I have added paths of required .zip files in CLASSPATH variable.
    Though I am able to compile the code, but when I try to run it thru java, it gives me error:
    Exception in Thread "main" java.lang.NoClassDefFoundError: TestInstallJDBC
    The .java and .class files are in current directory and I'm using
    java TestInstallJDBC.
    What can be the problem?
    Any help is appreciated.
    Thanks

    Ah, I re-read your first post - you said you added paths to the Classpath. So you need to add . to your Classpath as well. For Windows .;<existing_classpath> or for Unix .:<existing_classpath>

  • Exception when running a compiled java program in DOS

    I'm new to programming in general and java in specific. I am using the jGrasp programming software, and successfully compile my program, but when I try to run it out of DOS (which I undesrtand is the purpose of java to begin with, unless I'm mistaken), I get an exception that looks exactly like this.....
    Exception in thread "main" java.lang.NoClassDefFoundError: keyboard/java
    Caused by: java.lang.ClassNotFoundException: keyboard.java
    at java.net.URLClassLoader$1.run(Unknown Source)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at java.lang.ClassLoader.loadClassInternal(Unknown Source)
    I realize I may just be missing something simple, as I've not been in the class for very long, but the book doesn't seem to have the answer. It is "Starting out with Java: Early Objects, Third Edition, by Tony Gaddis. Any help will be apprecieated. The program is below, it's really short.
    The program is a simple one to teach myself scanner input and an 'if' statement:
    *     basic input program
    import java.util.Scanner;
    public class keyboard
         public static void main(String[] args)
              String Class;
              int age;
              String race;
              char sex;
              String gender;
              Scanner keyboard = new Scanner(System.in);
              System.out.print("What class do you wish to be? ");
              Class = keyboard.nextLine();
              System.out.print("How old is your character? ");
              age = keyboard.nextInt();
              keyboard.nextLine();
              System.out.print("What sex is your character? M/F? ");
              gender = keyboard.nextLine();
              sex = gender.charAt(0);
              System.out.print("What race is your character? ");
              race = keyboard.nextLine();
              if (sex == 'M')
                   System.out.println("Today you will be playing a " + race + " " + Class +
                                                           " who is " + age + " years old at the start " +
                                                           "of his adventuring career!");
              if (sex == 'F')
                   System.out.println("Today you will be playing a " + race + " " + Class +
                                                           " who is " + age + " years old at the start " +
                                                           "of her adventuring career!");                                   
    }

    Childofheinlein wrote:
    I'm new to programming in general and java in specific. I am using the jGrasp programming software, and successfully compile my program, but when I try to run it out of DOS (which I undesrtand is the purpose of java to begin with, unless I'm mistaken), I get an exception that looks exactly like this.....
    So summerizing some of what was said before and some of that wasn't.
    jGrasp is a simplistic IDE. When you pop a dos window from it it sets up the windows correctly to run your program. When you open a regular command window you must do the same yourself.
    >
    Exception in thread "main" java.lang.NoClassDefFoundError: keyboard/javaJava runs "classes". The command that you typed above meant that you were trying to run a "file". Specifically the file "keyboard.java". The two are not the same. There is however a relationship. When the source code, in this case inside of "keyboard.java" is compiled it produces a file called "keyboard.class". Insided of the file there is a "class" called "keyboard". Notice that the name of the class does not have either .java nor .class on the end of it.
    The VM (the 'java' command) finds a "class" using the class path to search files of various types for the class (again keep in mind that files contain classes but they are not themselves classes.)
    You can add to the classpath using the Sun VM using either command line options or environment variables. As noted in some of the previous messages those are "-cp" and "CLASSPATH". It is important to note that that does NOT fully specify the class path. But for your purposes it is sufficient to think of it as doing so.
    The 'default' setting for the part of the class path that you normally set (like via '-cp') is the current directory which is specified by the ".". So normally the following are equivalent.
    java -cp . keyboard
    java keyboard
    The reason the VM could not find your class when you opened the dos window yourself is because you were in the wrong directory. If you had been in the directory with the file "keyboard.class" then it would have worked (if you have not messed with the environment variable "CLASSPATH".)
    So if your class file has the following location: c:\myapps\java\keyboard.class then you can do the following.
    1. Open a console window
    2. Type "cd c:\myapps\java"
    3. Type "java keyboard"
    If the above does not work then you are in the wrong directory or the env variable CLASSPATH has been set to something.

  • Problem compiling java programs

    when i run javc in command prompt it runs fine but when i try to compile any program through command prompt it gives following error:
    javac: file not found
    usage: java <options> <source file>
    use -help for list of attributes
    what shouls i do plz help

    yogiis wrote:
    when i run javc in command prompt it runs fine but when i try to compile any program through command prompt it gives following error:
    javac: file not found
    usage: java <options> <source file>
    use -help for list of attributes
    what shouls i do plz helpuse set path="path of java/jdk/bin folder with double quotes" then press enter
    otherwise if you are ussing windows system goto to my computer properties and use advanced tab then use environment variables, there use user/system variables and check is there any exisiting path named variable is there or not if there click on edit and use ; and paste the complete path there. press ok, apply. Then use the command.

  • Compiling java programs

    Hi,
    Does it matter whether you compile your java program (to be run as applets) using jdk 1.5 or 1.4 or 1.3? Am I right to say that as long as it's compiled successfully, it will run from any browser?
    Thanks :)

    No, but the compatibility isn't with the browser but with the "plugin" that the browser uses to run Java.
    Each new major released of Java introduces new features and extensions to the class library which won't be there if the version of the plugin is older than the compiling environment.
    Class files actually contain the release number of the compiler that generated them and the JVM checks that it can handle the release in question.
    In a production environment you don't use applet tags but more complex HTML which specifies the release of the plugin required and directs the user to download the appropriate one if it's not already installed.
    (Annoyingly Windows Internet Explorer doesn't handle this properly if the person running the browser isn't allowed to install software).

Maybe you are looking for

  • How do I set up a mail account for an older macbook?

    I'm trying to set up a mail account for my dad on a used (but refurbished) macbook. It's running 0SX10.6.8. I'm not sure how to configure the incoming and outgoing mail servers. I didn't have to do this for my macbook air and my brother did not have

  • Cannot download latest update

    My iTunes says there is a new version and is giving me the choice to download or not.  I keep choosing to download it but it opens up the box to update my Apple software and Mobile Me.  I never can update my iTunes.  I'm sure it's available because t

  • Types of input to file adapter

    hi all, I am doing a file to mail scenario.And i wanted to send a text file as input.But while doing so i am getting mapping transformation error,since the data types and mapping fields are different from the input. its working fine for xml files. So

  • Time to time its giving error in the FTP connection

    Hi Gurus, Im doing File to File Interface. Im using FTP for File transfer and the message protocol is 'File'.  Im using the connection security as 'FTPS(FTP Using SSL/TLS) for control and data connection' and set the default command order.     I have

  • Selection Screen problem Urgent  ...

    Please find below  ; It doesn't care of selection screen .For example I want to take all material mtart is 'abc'  . How can I build that .For example there is one record instead of mtart (abc ) but when I enter bcd it also get something.   SELECT  *