Compile in 1.5 JVM and run in 1.4 JVM, work?

1 - If i have a class that only uses generic and other features that are only useful for compile-time, is it possible to run compiled classes in 1.5 JVM in 1.4 JVM?
2 - If i'm right, the JVM 1.5 features that are useful for compile-time, are removed in the classes. For instance, the generic types that we use in java classes disappear in the classes files. Is this true?
Thanks,

2 - If i'm right, the JVM 1.5 features that are
useful for compile-time, are removed in the classes.
For instance, the generic types that we use in java
classes disappear in the classes files. Is this
true?Not entirely.
If you do List<String> list = new ArrayList<String>();, then the <String> part is not kept. It's just a List.
But in the definition of the List interface, ArrayList class, etc., the fact that they take type parameters, and where, is kept. It has to be. How else could you even do List<String> in the first place?

Similar Messages

  • It compiles and runs, but scrollPane doesn't work.

    Bah. Why doesn't my scrollPane work? It compiles and runs but my scrollbars for the text area are nowhere to be found. This is the code I'm using to handle my scrollpane.
    public Display() {
                   setLayout(null);
                   setPreferredSize(new Dimension(270, 300));
                   setSize(270, 300);
                   items = new JTextArea(5, 5);
                   items.setBounds(5, 5, 270, 260); //x,y,width,height
                   items.setEditable(false);
                JScrollPane scrollPane = new JScrollPane(items);
                scrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
                scrollPane.setVerticalScrollBar(new JScrollBar(Scrollbar.VERTICAL));
                JScrollBar vScrollBar = scrollPane.getVerticalScrollBar();
                vScrollBar.setAutoscrolls(true);
                scrollPane.setVerticalScrollBar(vScrollBar);
                add(scrollPane, BorderLayout.CENTER);
                   add(items);
                   amount = new JTextField(".00");
                   amount.setBounds(5, 275, 266, 25);
                   amount.setHorizontalAlignment(JTextField.RIGHT);
                   amount.setEditable(false);
                   add(amount);
              }I'm also having a problem with this one. Apparently, my I uncomment this, the compiler says "cannot find symbol getImage()" which is odd because I've imported the proper package with this method.
    private ImageIcon icon = new ImageIcon("BKLogo.gif");
              public void paintComponent(Graphics background)
                   background.drawImage(background.getImage(), 0, 0, null);  
                   //setOpaque( false );
                   //super.paintComponent(background);
                   }

    You know what you need to do then: post an SSCCE (Short, Self Contained, Correct (Compilable), Example). For info on what this entails, look at these two sites:
    http://javafaq.mine.nu/lookup?22
    http://www.physci.org/codes/sscce.jsp

  • Got my website up and running but lightbox is not working properly

    Hi Everyone,
    I got my website up and running, but my lightbox isn't working properly. The descriptions of each painting is missing and the arrows and slideshow function is missing. I don't know what I did wrong.
    The link to the website is below.
    http://www.sainteustacefineart.com/Gallery%202.html
    The gallery is supposed to look and function like the gallery in the website linked below.
    http://www.labelsnlogos.com/
    I also did this website, so I'm at a loss as to what went wrong.
    Thanks!
    Ellen

    Okay, I got it working. I forgot to "put" the JS folder (which holds the Clearbox components). Something I overlooked because it was on the bottom of the files window and I didn't see it.

  • Compiled with jdk1.3.1_01 and run under VM 2.0

    I have compilied all my source code with jdk1.3.1_01 and ias6.0 sp3 uses jdk1.2.2 or 2.0VM....is this difference going to affect my application?

    Hi,
    It depends upon how your application is coded. If you use some of
    the functionalities which JDK 1.2 uses and incase JDK 1.3 doesn't likes
    that, you are likely to get errors. Infact, iAS encourages you to use
    the JVM which is bundled along with iAS SP3 and using JDK apart from
    that troubles. Please refer to my previous posting on iAS SP3 & JDK 1.3,
    I've tested them, which threw lots of errors. Hope this helps.
    Regards
    Raj
    Mansoor Quraishi wrote:
    I have compilied all my source code with jdk1.3.1_01 and ias6.0 sp3
    uses jdk1.2.2 or 2.0VM....is this difference going to affect my
    application?
    Try our New Web Based Forum at http://softwareforum.sun.com
    Includes Access to our Product Knowledge Base!

  • I AM UNABLE TO ATTACH A PICTURE WHEN I HAV EMY YAHOO MAIL UP AND RUNNING ON FIREFOX, THE "ATTACH" WORKS IF I HAVE AOL OR GOOGLE???

    WHEN I HAVE MY YAHOO MAIL OPEN ON FIREFOX, AND I AM REPLYING TO AN EMAIL [YAHOO], I WANT TO ATTACH A PICTURE, I AM UNABLE TO COMPLETE THIS TASK. IF I AM USING: AOL, GOOGLE OR EXPLOYER I HAVE NO PROBLEM COMPLETING THIS TASK

    Step 1
    Remove "MacKeeper" as follows. First, back up all data.
    "MacKeeper" has only one useful feature: it deletes itself.
    Note: These instructions apply to the version of the product that I downloaded and tested in early 2012. I can't be sure that they apply to other versions.
    IMPORTANT: "MacKeeper" has what the developer calls an “encryption” feature. In my tests, I didn't try to verify what this feature really does. If you used it to “encrypt” any of your files, “decrypt” them before you uninstall, or (preferably) restore the files from backups made before they were “encrypted.” As the developer is not trustworthy, you should assume that the "decrypted" files are corrupt unless proven otherwise.
    In the Finder, select
    Go ▹ Applications
    from the menu bar, or press the key combination shift-command-A. The "MacKeeper" application is in the folder that opens. Quit it if it's running, then drag it to the Trash. You'll be prompted for your login password. Click the Uninstall MacKeeper button in the dialog that appears. All the functional components of the software will be deleted. Reboot.
    ☞ Quit MacKeeper before dragging it to the Trash.
    ☞ Don't empty the Trash. Let MacKeeper delete itself.
    ☞ Don't try to drag the MacKeeper Dock icon to the Trash.
    Step 2
    From the Safari menu bar, select
    Safari ▹ Preferences... ▹ Privacy ▹ Remove All Website Data
    and confirm. Test.

  • Using different JREs to compile and run JNI program

    Hi,
    Is it possible to use a JRE to compile a JNI program and then use another JRE to run it? For example, I'm compiling my program linking with Sun's libjvm.so and libjava.so. But at run time, I'll change my LD_LIBRARY_PATH to point to IBM's libjvm.so and libjava.so. Would it work at all?

    Oh I forgot to mentioned that I'm trying to invoke JVM in a C program to execute pre-compiled java byte code. (my bad... should've made that clear) So when I say "compile", I mean to compile C files instead of java files. So my original question is: is it possible to compile a C program invoking JVM linking with java and jvm libraries from vendor A and then at runtime, swapping java and jvm libraries with the ones from vendor B? (Since libjava.so and libjvm.so are dynamic libraries, it should work. But I was just making sure...) After some testing, I was able to compile my C program linking with Sun's libraries and to run it with IBM's libraries.

  • How to compile and run a java program?

    I am getting this error message, what to do?
    Exception in thread "main" java.lang.NoClassDefFoundError:
    Thanks for you help.
    Ajay

    Hello,
    I believe that this error is caused because when you
    compile and run a java program, you have to use the
    same name that is next to public class. For example,
    the program name is next to the word public class.
    For example, if a program began like this:
    public class Concat
    then the name of the program in this case is Concat
    and when you compile it you type: javac Concat.java
    when you run it type: java Concat
    depending on the name of your program.and depending on whether the class is in a package. And depending on what directory you are currently in.
    Also depending on if you set your class path you might
    have to type the above like this: jdk1.2.1\bin\javac
    Concat.java to compile, and to run you would have to
    type jdk1.2.1\bin\java Concat where you would replace
    Concat with the name of your program and replace
    jdk1.2.1 with the name of your version of java, that
    is again if you do not have your classpath set. Hope
    this helps.Your examples have nothing to do with whether the CLASSPATH is set--only with whether the PATH is set. And, it may not be jdkXXX\bin. The path to the JDK (in this case, to javac and java executables) could be anything. Classpath should be set on the command line. The OP probably did NOT set a classpath on the command line (preferred), or in the environment variables.
    Also, make sure you did not forget to put:
    public static void main(String[ ] args)
    on the line underneath the line where it says "public
    class Concat" where Concat is the name of your
    program. Again, I hope this helps.Irrelevant (with the info we have from the OP so far). The error says that the JVM can't even find the class--not that the class doesn't have a main. The "main" referred to in the error message is within the JVM itself.
    OP: Did you fix your problem? If not, what directory are your files in? Are they in a package? What command are you typing to get that error? That is, please tell us your entire command line.

  • [Help] Compile and running a java which uses libraries in linux

    I have a java program which has all it's *.java files in the src directory. it uses libraries (e.g. activemq-core-5.1.0.1.jar and commons-logging.jar) stored in a folder called libs which is in the directory level as the src folder.
    how do i compile this program in linux and convert it to a jar file?
    once compiled how do i do run it? will simply running the jar file i just created be sufficient?

    I don't know what your application does but the basic way of compiling classes in Linux is
    javac -classpath    ALL_DEPENDENCY_LIBS    PATH_TO_SRC_FOLDERAnd in case of Linux the dependency files ought to be separated by : and not ;
    I would suggest you have a look at ant or maven for building your project,
    To start might be difficult, but it will surely payoff as you build large projects once you know how they work!

  • How to compile other java files and run them from my own programs?

    I'm developing a unit testing tool for AspectJ, which can originally generate the stubs for aspect unit to be tested. All these stubs are java files. After generation of stubs, how can I program the code to compile this unit together with these stubs, i.e. how can I put the functionality of compilation and run, e.g. command "javac *.java" and "java *", into my own code.
    Hope you can understand what I mean.
    Thank you in advance.

    When I use Runtime.getRuntime().exec(command) for executing the AspectJ compile command "ajc", "IOException createProcess error=2" always occurs, while it is ok for Java comiple command "javac".
    Why this happens when I use Runtime.getRuntime().exec("ajc Hello.java Test.aj")? Is it the reason that Runtime.exec(String) may not support any command in DOS?
    (ajc is the compile command for the java file and aj file.)
    Thank you in advance.

  • How to Compile and run Smart Card Application

    hi
    any one can help me reagrding Javacard API. i download the JavaCard Development Kit from sun and install on my machine but i didn't get all java files and class files of JavaCard API. where i obtain those files so my application get compile and run.
    pls help me i m new in this technology.
    Thanks in Advance.

    My program Test.java in F:\Tomcat5\webapps\Ambika\WEB-INF\Classes. I compiled in the format below. I got like this. What should I do for this? But yesterday I compiled like this only, It compiled and the folder com\cert\Test.class is created. Today again I compiled the pgm after deleting the already created folder 'com\cert', I got the error like this.
    I've given my pgm and the thing I've got when I compiled it.
    Test.java
    package com.cert;
    public class Test
         public void display()
              System.out.println("Hai");
    F:\Tomcat5\webapps\Ambika\WEB-INF\Classes>javac -d F:\Tomcat5\webapps\Ambika\WEB-INF\Classes\Test.java
    javac: no source files
    Usage: javac <options> <source files>
    where possible options include:
    -g Generate all debugging info
    -g:none Generate no debugging info
    -g:{lines,vars,source} Generate only some debugging info
    -nowarn Generate no warnings
    -verbose Output messages about what the compiler is doing
    -deprecation Output source locations where deprecated APIs are u
    sed
    -classpath <path> Specify where to find user class files
    -cp <path> Specify where to find user class files
    -sourcepath <path> Specify where to find input source files
    -bootclasspath <path> Override location of bootstrap class files
    -extdirs <dirs> Override location of installed extensions
    -endorseddirs <dirs> Override location of endorsed standards path
    -d <directory> Specify where to place generated class files
    -encoding <encoding> Specify character encoding used by source files
    -source <release> Provide source compatibility with specified release
    -target <release> Generate class files for specific VM version
    -version Version information
    -help Print a synopsis of standard options
    -X Print a synopsis of nonstandard options
    -J<flag> Pass <flag> directly to the runtime system
    F:\Tomcat5\webapps\Ambika\WEB-INF\Classes>
    Plz help me.
    thanks in advance
    Ambika

  • How to compile and run servlets in Eclipse?

    Does somebody known how can I compile and run servlets in Eclipse IDE? I've added and configured Tomcat's plugin. I've created a project with my example servlets source, and I don't know what farther. How do I have compile it without main method? I must add web.xml file from Tomcat's directory into projects in Eclipse and modify it?
    THX Chudzik

    Try googling for "eclipse servlet", surely someone has written instructions.

  • How can I compile and run other java classes from within an application?

    Hello there everyone! I really hope that someone can help me. I am writing a program that must be able to compile and run other java classes that are in different files, much like development environments like Kawa or Forte allow you to do.
    There has to be a way of doing this ( I hope!! ), but i can't seem to find it!!
    I have tried using this command to compile:
    Runtime.getRuntime().exec ("c:\\programs\\javac className.java");
    ...and this one to run:
    Runtime.getRuntime().exec ("c:\\programs\\java className");
    ...but neither works!!! I can compile and run classes that are in the same file as my application, but I can't get it to work at all for files in different directories or files.
    PLEASE, PLEASE, PLEASE help me - i've run out of ideas, and i need this to be working in 3 days!!!
    Thank you very much for any help anyone can give me, I really appreciate it!! Thanks again!!
    Adrian ( ...in distress!! )

    public class JavaCompiler{
       public static void main(String[] args)throws Exception{ //sorry bout the laziness
          if(args == null || args.length != 1){
             System.out.println("Usage: java JavaCompiler MyClass.java");
             System.exit(0);
          String className = args[0];
          Runtime rt = Runtime.getRuntime();
          Process p = rt.exec("javac " + className); //consider setting cpath for this
          p.waitFor();
          //now try to run after it is done.
          p = rt.exec("java " + className.substring(0, (className.length() - ".java".length()));
          p.waitFor();
          //do some other stuff
    }This should get you going. You may consider looking into the System.getProperty() method in order to determine the type of OS it is running on in order to findo out what command to run. I know that the sun tool listed above is nice, but by my understanding the sun tools provided are not guaranteed to stay the same. I'm no expert on this matter, but that is one of the reasons there is no API documentation for those tools. Also, I don't believe those tools come packaged with the JRE. (Of course if you are making an IDE it will be expected that the user has an sdk installed. Good luck with figuring this thing out.

  • NoSuchMethodError compiling with 1.4 and running on 1.3

    Hi community,
    I have a little problem with code like the following when mixing both JDK versions:
    StringBuffer sb1 = new StringBuffer();
    sb1.append(new StringBuffer());In 1.3 this is linked to append(Object) and in 1.4 to the newly added append(StringBuffer) which does not exist in 1.3. The code compiles fine with both versions, but if compiled under 1.4 and run in 1.3 this throws NoSuchMethodError(as it should, of course).
    I understand why it is so, the question is if there is an easy way to overcome this problem. I played with the target option of javac without success(javap shows it is always linked as stated), also I read a bit in the JLS to make sure I am right why the exception is thrown.
    I see the following choices:
    1. Compile with 1.3. Not a good idea because all other our products are developed and run in 1.4;
    2. Ask the customers to upgrade to 1.4. There is some their reason for which they still stick to 1.3 and don't want to upgrade, we can't force them do it;
    3. Find such places in code and explicitly cast. But who will know what other cases like the above exist in the code. I can find where append(StringBuffer) is used in the code, but what about other methods of other JDK classes? And it is a bad idea because somewhere in time it will anyway run with 1.4.
    My question is if there is another easier option that I am missing at the moment.
    Thanks for you time and cooperation
    Mike

    Why is option 1 bad? You will be able to run it in 1.4 even if you compiled it using 1.3, so I don't see the problem? It will never run in 1.3 if you can't compile it in 1.3.Because it will always be a source of errors. Always there will be someone that will not set up their project to use 1.3 for compile or will deconfigure it while working with the other projects. Besides that as I stated source compiles fine in both versions, I don't have a compiletime problem, but a runtime one.
    I know this is the most reasonable option, I know what I would choose among the three listed above, I needed some confirmation if I have missed an option.
    and you are correct about the target flagI only mentioned the target tag just as one of the directions of my search, we always whine for others not putting effort in their problems ;)
    Thanks for opinions
    Mike

  • How to Compile and run a GUI project made in Netbeans from shell

    hi all .....
    I develpoed a java project using Netbeans .The project has GUI also (JFrame and various layout ) . The project is building and running fine through netbeans .But when I tried to compile the source files (*.java files) from shell , I failed .
    The project has two files MainFrame.java (JFrame file and this file has the public static void main method ) and helloworld.java (simple java class file). But the "src" folder created by netbeans (at project location) contains one more file named "MainFrame.form" . Moreover netbeans was using two jar files (AbsoluteLayout.jar and Swing-layout-1.0.jar .
    I tried to compile the two .java files . helloworld.java compiled successfully but the MainFrame.java didnt. I used the command :
    linux:~/netbeans projects/Network tool/src/mytool # javac -classpath ".;AbsoluteLayout.jar;Swing-layout-1.0.jar;" MainFrame.java
    The 14 errors were encountered. MOst of them were like :
    MainFrame.java:138: package org.jdesktop.layout does not exist
    org.jdesktop.layout.GroupLayout jPanel1Layout = new org.jdesktop.layout.GroupLayout(jPanel1);
    ^
    Help, suggestion or guidance of any type is welcomed .(Keep in mind that project is running fine when done using netbeansIDE).
    waiting for reply....

    Hello,
    1. The .form file was used by Netbean's GUI builder to create the .java and is not needed for compilation.
    2..../src # javac -classpath "..." mytool/*.java
    I guess the package mytool was not coped with.
    Alternatively it is worth to use the ant build tool also used by Netbeans.
    Then you can make a jar from the class files, indicate in the manifest.mf file:
    1. the main class
    2. the library jars

  • How to Set up the  variables and others to compile and Run Java Programs

    Hello,
    I have just downloaded the jdk1.6.0_07 and jre1.6.0_07 and installed it in C:\Program files\Java in my Windows XP ,So please tell me how to sett up the enviroment variables etc to compile and run Java Programs from Command Prompt.
    thanks

    To set the PATH permanently, add the full path of the jdk1.6.0_<version>\bin directory to the PATH variable. Typically this full path looks something like C:\Program Files\Java\jdk1.6.0_<version>\bin. Set the PATH as follows on Microsoft Windows:
    1. Click Start > Control Panel > System on Windows XP or Start > Settings > Control Panel > System on Windows 2000.
    2. Click Advanced > Environment Variables.
    3. Add the location of bin folder of JDK installation for PATH in User Variables and System Variables. A typical value for PATH is:
    C:\Program Files\Java\jdk1.6.0_<version>\bin

Maybe you are looking for

  • Exe build with database conn and report generation vi's?

    I tried to build an .exe and learned the hard way that there are many things needed to be included for this to work.  As is now my program is not working. I wanted to get a list of necessary steps to make a successful build.  Please correct me if I a

  • Invoice is not Release MRBR after GR

    Hello, *Usually the vendor sends invoice before the good is receipt. The invoice is paid after the GR.*we want the set up (1) create purchase order** (2) MIRO the PO** (3) IR becomes blocked** (4) Run MRBR - invoice receipt not released due to GR not

  • I tunes is skipping

    I read several posts about this, but nothing seems to be helping the issue. My i tunes is skipping on every song. Is there a way to fix this problem?

  • Problem unlimited restart Nokia C7

    Hi,before 2 days i buy Nokia C7. Today i restart them and when i try start him again start "unlimited restart" 6 hours after is same problem when i try start my nokia - they start and shutdoun alone non-stop and i cant do nothing... Imposible update

  • Camera Profiles and DNG Profile Editor beta 2 now available

    Hi everyone, Beta 2 of the camera profiles and DNG Profile Editor are now available. Please visit here and enjoy: http://labs.adobe.com/wiki/index.php/DNG_Profiles I hope to have more detailed release notes/changes for you soon. You are welcome to as