.java file compiling but not executing in jdk6

Using javac in jdk6 I can compile a .java file but cant executing the same using java command from my own directory. I can still compile and execute the same file from jdk\bin directory. I am using windows XP Home. While executing the .java file from my own directory, it fires a message: "The Java class could not be loaded. java.lang.UnsupportedClassVersionError: Myfilename (Unsupported major.minor Version 50.0)". i have set path in environment variable as "C:\sun\sdk\jdk\bin" where jdk placed in sun\sdk.
Please help me to solve the problem

This isn't information we can give you. You have to set it up based on your system.
Do you understand how execution paths work? There's a list of filesystem paths, separated by a semicolon or a colon depending on the system, all concatenated into one big string. The entries earlier in the string are looked in first.
So if your path has this:
c:\Windows\java;c:\sun\sdk\jdk\bin
Then if you type "java" from the command line, the Windows one would be executed, not the JDK 6 one.

Similar Messages

  • .java files compile but cannot execute

    Hello,-
    I have a small problem in that the compiler can find the .java file (javac javaFile.java), however the execute command (java javaFile) does not work (Exception in thread "main" java.lang.NoClassDefFoundError: javaFile). I'm using Windows Vista and JDK 1.6.0_02. Which one of the environment variables is responsible for file execution?
    Thanks beforehand, Vahagn

    @ smithberry: Now it executes! Thanks for pointing that out and apologies for not seeing the space before the filename. But how come this is at all necessary? Do I have to run all my java programs with this command from now on, including the JUnit TestCase extensions?

  • Compiling but not executing

    import java.util.Random;
    * A guessing game of high/low
    class HighLow {
       * a randomly generated number to be guessed
      private int number;
       * indicates if number has been guessed or not
      private boolean guessed;
       * Initializes the game, setting number to be something
       * between 0 and upperBound
       * @param upperBound the maximum that the number can be
      public HighLow( int upperBound ) {
        if( upperBound < 0 ) {
          upperBound *= -1;
        // a random number generator
        Random r = new Random();
        // set the number to a random number
        // between 0 and upperBound
        number = r.nextInt( upperBound );
        guessed = false;
       * Initializes the game, setting number to be something
       * between lowerBound and upperBound
       * @param upperBound the maximum that the number can be
       * @param lowerBound the minimum that the number can be
      public HighLow( int lowerBound, int upperBound ) {
        // a random number generator
        Random r = new Random();
        // set the number to a random number
        // between 0 and upperBound
        number = r.nextInt( upperBound - lowerBound );
        number = number + lowerBound;
        guessed = false;
      // accepts an integer. prints out if that
      // argument is higher than, lower than, or
      // equal to number
      public void check( int guess ) {
        if( !guessed ) {
          if( guess > number ) {
            System.out.println( "Too high" );
          } else if( guess < number ) {
            System.out.println( "Too low" );
          } else {
            System.out.println( "Good job!" );
            guessed = true;
        } else {
          System.out.println( "You already guessed it! It's " + number );
    }error: Exeption in thread "main" Java.lang.nosuchMethodError : main

    1) You do not have to make a new message for each error, it still applies on the same thread.
    2) where is your main part of the application ? Are you trying to run an applet ?

  • ICal failing to run applescripts: The 'Open' button does not change to 'Run', and the script file is opened but not executed on alert.

    iCal failing to run applescripts: The 'Open' button does not change to 'Run', and the script file is opened but not executed.

    Calendar (not called iCal anymore) does not include that capability any longer, apparently.  What you have to do now is go to Automator and create a Calendar Alert action.  You can add a Run AppleScript object to the action and paste in your script there, then when you save it, it will become available as a choice in the alert menu in Calendar.

  • How to remote desktop user can read, write ,modify and traverse folder but not execute?

    Now I ceate a user accout whis is user type and put him into remote desktop group.
    he can login this server by remote desktop.
    My server is windows 2003 but not in nt domain and  it is a workgroup computer.
    I want to limit him access right on one folder in which have many folders and .exe file.
    I only want he can read , write,modify file and traverse folder but not execute any .exe file.
    How can I implement this through NTFS.
    Please give me some advice.

    Hi,
    I think you could using advanced option to configure the file or folder permission:
    http://technet.microsoft.com/en-us/library/bb727008.aspx
    Regards.
    Vivian Wang

  • Where are the .java files compiled from .jsp files stored?

              hi,
              I'm new to weblogic server. When I use Tomcat as the jsp server, it compiles .jsp
              files to .java files and then .class files. So when an error reported I can track
              it in the .java file.
              But what should I do with weblogic? It only saves the .class files in the work
              dir. Or is there a better way to trace errors in jsp files?
              Thanks!
              

    This should give you the information you need to set the keepgenerated flag:
              http://e-docs.bea.com/wls/docs60/jsp/admin.html#53346
              Also, the .java files will be right next to the .class files with are under
              a tmp directory in the /WEB-INF directory under the WEB-INF if it is an open
              directory or in the
              config/mydomain/applications/.wl_temp_do_note_delete/WEB-INF directory if it
              is .war file.
              Sam
              "Raymond" <[email protected]> wrote in message
              news:3b931619$[email protected]..
              >
              > Thanks, but can you tell me more about it? where to set this flag? I'm
              using WLS
              > 6.0sp1.
              >
              > "Sam Pullara" <[email protected]> wrote:
              > >You can turn on the keepgenerated flag if you want to keep the .java
              > >files.
              > >How you do this depends on what version you are using.
              > >
              > >Sam
              > >
              

  • HT1661 My mid-2009 MacBook Pro has just died via a painful (for me) hard drive failure. I backed up a good percentage of files recently but not enough to keep me happy.  I need to access the dead drive on the MBP via a 2008 iMac. Best options?

    My mid-2009 MacBook Pro has just died via a painful (for me) hard drive failure. I backed up a good percentage of files recently but not enough to keep me happy.  I need to access the dead drive on the MBP via a 2008 iMac. Best options?
    I have ordered a 800 firewire to 800 firewire cable and am hoping to use the target mode option to copy files from the MBP.
    Is this possible?
    Hope so!
    Any advice and or help would be greatly appreciated.
    Many thanks,
    Neil

    Thanks Ogelthorpe.
    Just bought an enclosure to try that also.
    Hoping the MBP isn't really dead but just feigning death
    Fingers crossed.

  • I received a replacement iPad. On my original iPad I had dozens of books and PDF's. I completely backed up my original iPad. The categories of my iBook files transferred but NOT the actual PDF and Books. Please help.

    I received a replacement iPad. On my original iPad I had dozens of books and PDF's. I completely backed up my original iPad. The categories of my iBook files transferred but NOT the actual PDF and Books. Please help.

    Are the PDFs and ibooks on your computer's iTunes ? If so then you should be able to re-sync them, if not then you can re-download ibooks for free as long as they are still available in the store and you use the same iTunes account as you originally used to buy them : http://support.apple.com/kb/HT2519 . The backup doesn't contain the contents of the ibooks app, so for them to be restored to the device they needed to be in your iTunes library.

  • Java files work but jar files do not

    Hello everyone!
    My java files run normally and I get a response that I expect (which is successful). Imagine my surprise when I collected them in a Jar and the very same files inside the jar no longer work! I get a response (still generated by my java program) from successful, it turns to Query Expire.
    My problem is, when executed as normal java programs, the expected result is produced. However, when the jars are executed, the result is expired. What is wrong? The classes and the ones in the jar are the same. Is there something different with the mechanism of Jars that make it erroneous?
    Many thanks in advance. I have been working with this for a week with no progress! =(

    Hi!
    Thanks for your reply. Here's what's happening so far:
    I created my java files using Eclipse and using the Export option, I exported them as a JAR.
    When I run my application on Eclipse with the Java files in tow, the output I expect is Done sending: wait for responses now
    Received response from billing api- A: null(0), C: 13, E: Account already registered
    Register: Failed: 1 Failure(s)Now, on to the JAR file.
    I executed the JAR file using the command java -jar <jar name.jar>
    Here's the response:
    Done sending: wait for responses now
    Received response from billing api- A: null(0), C: -1, E: Query expire w/o response
    Register: Failed: 1 Failure(s)My program communicates with a database and this generates the reply that should be received by my program. My ordinary Java file gets the expected output, but the JAR does not.
    Is it possible that the JAR file somehow slows down the transaction? The reply sent by the database isn't received by the JAR -- somehow, the message gets lost.

  • [weblogic-9.1] JSP 2.0 tag file gets compiled but not reloaded

    I am trying to use a JSP 2.0 tag file on weblogic 9.1. Everything works as expected until I reload the page after changing the tag file. Consider the following files, simple.jsp and simple.tag:
    h5. /simple.jsp
    &lt;%@ page language="java" %&gt;
    &lt;%@ taglib prefix="sandbox" tagdir="/WEB-INF/tags" %&gt;
    &lt;html&gt;
    &lt;body&gt;
    This output comes from the jsp.
    &lt;sandbox:simple&gt;
    &lt;/sandbox:simple&gt;
    &lt;/body&gt;
    &lt;/html&gt;h5. /WEB-INF/tags/simple.tag
    &lt;%@ tag language="java" %&gt;
    <div>This output comes from a tag file
    </div>The output of a call to simple.jsp is:
    <html><head>
    </head><body>
    This output comes from the JSP.
    <div>This output comes from a tag file</div>
    </body></html>So far, so good. Now I change the content of simple.tag to
    <%@ tag language="java" %>
    <div>This output comes from *simple.tag*<div>On a new call to simple.jsp,
    1. Weblogic notices that the file has been changed,
    2. generates the TagHandler .java file
    3. compiles the .java file
    But the new class file seems not to be loaded by weblogic; the resulting HTML does not change. It is not a browser cache issue, as I can see Javelin compilation errors. E.g., changing the tag file content to
    <%@ tag language="j" %>
    <div>This output comes from simple.tag</div>leads to the following (expected) error:
    Compilation of JSP File '/sandbox/simple.jsp' failed:
    simple.tag:1:18: "j" is not a valid setting for the language attribute.
    <%@ tag language="j" %>
    ^-^
    Changes to the .jsp file are reflected in the HTML output.
    Am I missing something? Is there any flag I have to set in my weblogic configuration?

    You are right in saying that decoding has nothing to
    do with rendering per se.I will go even further than Erik did, and dispute this statement.
    Consider that you are generating an <input> tag for a text field. Among other things, you have to generate a "name" attribute. Who decides what to put there? The renderer that actually created the markup.
    The "renderer" really does
    two completely different things. But both should
    nevertheless be separate from the component
    implementation itself. You could still have the
    renderer doing the decoding part, which arguably would
    rarely change, and somehow delegate the actual
    rendering to an implementation in a tag file.Whether you implement decoding in a separate class or inside the component, what request parameter name do you look for? It is not reasonable to assume that ALL possible renderers will choose the same parameter name ... hence, decoding and encoding are inextricably linked (the code doing the decoding has to know what kind of markup the code doing the encoding actually created). In JavaServer Faces, the current APIs create that linkage by requiring that the decode and encode be done by the same class (either the component, if you are not delegating, or the renderer if you are).
    Craig

  • JSF webapp works with Java 1.4, but not Java EE 5

    Hello
    I am having a really weird problem with internationalizing my JavaServer Faces web application.
    I am using Netbeans 6.0, Tomcat 6.0.10, JSF 1.2, and JTSL 1.1....
    If I use Java 1.4 to run the webapp, everything works fine!
    If I use Java EE 5 then it fails to execute internationalization of my choosen locale.
    I could just use Java 1.4 and have my site working fine, but I would really like to use Java EE 5 since it can do more. Also I don't see why it can work on one version of Java but not another. My locales are English (en) and Korean (ko).
    This is my index.jsp
    <%--
        Document   : index
        Created on : 2/05/2008, 01:33:01
        Author     : Steve
    --%>
    <%@page contentType="text/html" pageEncoding="UTF-8"%>
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    "http://www.w3.org/TR/html4/loose.dtd">
    <%@taglib prefix="f" uri="http://java.sun.com/jsf/core"%>
    <%@taglib prefix="h" uri="http://java.sun.com/jsf/html"%>
    <%@taglib prefix="c" uri="http://java.sun.com/jstl/core"%>
    <html>
        <f:view locale="#{localeBean.language}">
            <f:loadBundle basename="resources.messages" var="msg"/>
            <head>
                <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
                <title>JSP Page</title>
            </head>
            <body>
                <h2>Hello <h:outputText value="#{localeBean.country}"/>!</h2>
                <br>
                <h4><h:outputText value="#{msg.language}"/>:</h4>
                <h:form id="languageForm">
                    <h:selectOneMenu   onchange="this.form.submit();" valueChangeListener="#{localeBean.dropdown1_processValueChange}">
                        <f:selectItem itemLabel="English" itemValue="en"/>
                        <f:selectItem itemLabel="������" itemValue="ko"/>
                    </h:selectOneMenu>
                </h:form>
                <h:outputText value="#{localeBean.language}"/>
            </body>
        </f:view>
    </html>This is my localeBean which is under the package "resources"
    * To change this template, choose Tools | Templates
    * and open the template in the editor.
    package resources;
    * @author Steve
    import java.util.Locale;
    import javax.faces.event.ValueChangeEvent;
    public class localeBean {
        private String language = Locale.getDefault().getLanguage();
        private String country = Locale.getDefault().getCountry();
        public String getLanguage() {
            return language;
        public void setLanguage(String newValue) {
            language = newValue;
        public String getCountry() {
            return country;
        public void setCountry(String newValue) {
            country = newValue;
        public void dropdown1_processValueChange(ValueChangeEvent vce) {
            setLanguage((String) vce.getNewValue());
    }This is my faces-config file
    <?xml version='1.0' encoding='UTF-8'?>
    <!-- =========== FULL CONFIGURATION FILE ================================== -->
    <faces-config version="1.2"
        xmlns="http://java.sun.com/xml/ns/javaee"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-facesconfig_1_2.xsd">
    <application> 
            <locale-config>  
                <default-locale>en</default-locale>  
                <supported-locale>en</supported-locale>
                <supported-locale>ko</supported-locale>
            </locale-config>
            <message-bundle> resources.messages </message-bundle>
        </application>
        <managed-bean>
            <managed-bean-name>localeBean</managed-bean-name>
            <managed-bean-class>resources.localeBean</managed-bean-class>
            <managed-bean-scope>session</managed-bean-scope>
        </managed-bean>
    </faces-config>and lastly I have my message bundle under the "resources" package which is named "messages".
    This has a key word "language" which is "Language" in the 'en' locale file and "����" in the 'ko' locale file.
    Once again when using Java 1.4 this project runs fine, however with Java EE 5 it does not.
    You may notice in my index.jsp that I have <h:outputText value="#{localeBean.language}"/>
    I use this to display the locale that has been chosen by my select box. Even when this shows a different language has been chosen the page does still not display in the correct language. According to <f:view locale="#{localeBean.language}"> then the locale of the page should be changed.
    I have looked over the web quite far for an answer to this problem. But everyone else seems to be using a similar method of loading up a message bundle and using it the same way I am. However my method does not work.
    Any suggestions or clues to what is going wrong would be really appreciated.
    Thanks in advance^^

    it seems that the
    <f:view locale="en">
    only work if a ressource bundle with the locale sufix '_en' is provided.
    Everything works now if I provide 3 ressouce files:
    global_en.properties
    global_de.properties
    global.properties
    global.properties and global_en.properties are identically!
    But if I delete the global_en.properties file always the global_de.properties file wins before the default properties.
    I did not expect such a behavior :-(

  • Flex Application showing no errors in Eclipse but not executing either

    Hello,
    I am trying to develop an application in flex/BlazeDS/Java in eclipse and my problem is since my changes in the code are not reflected anymore during runtime of the application. There is no error received from eclipse when I try to clean the project. It is deployed correctly but it seems to be working with the old code and not reflecting the changes. I tried to put the breakpoint too but it says, 'breakpoint cannot be placed here because there is not executable code in this line'
    Please advice.
    Best Regards,
    Jai Kishan Shah

    Hello,
    Well, i never re-install the FlexBuilder (stand-alone, or eclipse-plugin) because any error.
    Your output folder in Flex Build Path on your Project Properties is correct? Other question, you are working with Java ? Many times the project have a "error" on configuration and the directory to deploy is not listen by web-server.
    Exemple:
    If i work with Java and my CATALINA_HOME is: C:\tomcat\ - My webapps is localizated on: C:\tomcat\webapps\MYWEBAPP\ but my output folder on FlexProject is: C:\MyProject\Flex\bin-debug, and i run the application, the application dont work...
    So.. can you show your configuration? Its more easy to understand your problem and help you.
    Regards

  • Swf file works but not html when preview and publish

    hi,
    i made a simple nav bar with a dropdown menu it works fine in flash mode and preview but when i try to embed into html it only show the nav bar but not the dropdown menu. please advice.
    thanks in advance!

    http://lunarvision.zxq.net/banner_flash_test.swf // the swf file
    http://lunarvision.zxq.net // when it on the website.
    thanks!

  • I've set the download settings to always ask where to save a file, and it will do that for some file extensions, but not for others. How can I fix this?

    I've noticed it especially with .pdf files, which always end up on my desktop, even after I double check the download settings under Preferences and then restart Firefox, just in case. Also, when I download .pdf files they will automatically open, but when I download .doc files they do not. I would rather not have downloaded files automatically open, but I can't find how to change that setting either.

    You can check for problems with preferences.
    Rename or delete the prefs.js file and possible numbered prefs-##.js and user.js files to reset all prefs to the default value.
    *http://kb.mozillazine.org/Preferences_not_saved
    *http://kb.mozillazine.org/Resetting_preferences

  • Problem with .sitx files (Safari but not Firefox???)

    Hi All,
    I have a website online (with help from iWeb and BBEdit) but am having a problem I cant figure out (this IS my first website!)
    I am hoping that someone much more knowledgeable than me can help me with it.
    I basically have a download section. Icons and desktops.
    Now, when I (or anyone else) tries to download- everything seems to be fine in FireFox (even IE!) but not in Safari.
    My desktops are compressed as .zip files. No problems there, everyone can download and open (including Safari users!)
    My icons are compressed as .sitx files. This is where the problems come in. Firefox and IE download them no problem ('save to disk?' etc) However when one attempts to download the icons (.sitx files) with Safari it simply displays pages of gibberish (starting with the word 'Stuffit') which I am presuming is Safari trying to 'display' the contents of the actual stuffit file.
    Why is this? Why wont safari simply download the .sitx files as it does .zip files?
    Does Safari have some sort of inherent problem with .sitx files? Is it some sort of configuration within Safari preferences? or (and probably most likely!) is it something I have done wrong?
    Oh, my website (page in question!) can be found here:
    http://aoimedia.co.uk/news/news.html
    Thanks in advance for all your valuable help
    Kind regards
    John
    12 G4 Powerbook/Superdrive. (she's named Skates!) Mac OS X (10.4.4)

    Hi,
    It sounds like the server the website/file is hosted on is not identifying the type correctly. As you've seen, different browsers will handle this situation differently.
    Have a read of this article:
    http://www.macosxhints.com/article.php?story=20040211102018600
    Hope that helps.

Maybe you are looking for