Simple J2SE 1.4 question

Hi,
I'm a bit confused as to how the java compiler, jvm, etc. works.
I've developed code ( a Servlet and some classes) using J2SE 1.3 . I would like to use 1.4 so that I can use assertions. If I use 1.4 and assertions will the code run on just about any Servlet container? Even if it is using J2SE 1.3? I do not need any other J2SE 1.4 features, just assertions.

No, it wouldn't work. The VM must support assertions. As well as have them explicitly turned on on the command line.
Actually, if you try to run code compiled with 1.4 on a 1.3 VM, it will refuse to load your classes, complaining about incompatible or unsupported class format.
Pretty much every servlet container (except some IBM-produced ones) allow you to use whatever VM you want to use, so shouldn't be too much of a problem.
.P.

Similar Messages

  • Can we make jar file for simple j2se application

    Hi..Can we make a jar file for simple j2se application so that it can be executed on any system like .exe file...

    Read the JAR files section in Sun's Java tutorial.

  • Simple, funny but annoying question, putting a pixel

    Maybe this could be simple, funny but annoying question.
    How do you put a pixel or draw a pixel?
    Is there a method to draw a pixel directly on screen in j2SDK API?

    This is a very open ended question, do you want to draw a pixel in an image or just draw a shape on the screen?
    If you want to edit single pixels at a time then the best option is to create a BufferedImage and use the WritableRaster to edit the pixels you want by using setPixel().
    Something like the following:
    BufferedImage img = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB);
    WritableRaster raster = img.getRaseter();
    raster.setPixel(x_coord, y_coord, new int[]{R_val, G_val, B_val});This image can then be displayed by putting it in a JLabel (there are many other techniques but I find this the easiest method).
    JLabel l = new JLabel(new ImageIcon(img));
    JFrame jf = new JFrame();
    jf.setContentPane(l);
    jf.pack();Alternatively, you can draw shapes by using Graphics or Graphics2D objects
    e.g.
    public class MyPanel extends JPanel
      public void paintComponent(Graphics2D g)
         super.paintComponent(g);
         g.drawLine(x1,y1,x2,y2);
    }Hope this helps,
    Stef

  • Very simple XSLT string replacing question

    Hi,
    This is a really simple question for you guys, but it took me long, and i still couldn't solve it.
    I just want to remove all spaces from a node inside an XML file.
    XML:
    <?xml version="1.0" encoding="UTF-8"?>
    <root insertedtime="2008-05-01T14:03:00.000+10:00" pkid="23421">
       <books>
          <book type='fiction'>
             <author>John Smith</author>
             <title>Book title</title>
             <year>2 0  0 8</year>
          </book>
       </books>
    </root>in the 'year' node, the value should not contain any spaces, that's the reason why i need to remove spaces using XSLT. Apart from removing space, i also need to make sure that the 'year' node has a non-empty value. Here's the XSLT:
    <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
        <xsl:strip-space elements="*"/>
        <xsl:template match="@*|node()">
            <xsl:copy>
                <xsl:apply-templates select="@*|node()"/>
            </xsl:copy>
        </xsl:template>
        <xsl:template match="//books/book[@type='fiction']">
            <xsl:copy>
                <xsl:apply-templates select="@*"/>
                <xsl:attribute name="id">101</xsl:attribute>
                <xsl:call-template name="emptyCheck">
                    <xsl:with-param name="val" select="year"/>
                    <xsl:with-param name="type" select="@type"/>
                    <xsl:with-param name="copy" select="'true'"/>
                </xsl:call-template>
                <xsl:value-of select="translate(year, ' ', '')"/>
            </xsl:copy>
        </xsl:template>
        <!-- emptyCheck checks if a string is an empty string -->
        <xsl:template name="emptyCheck">
            <xsl:param name="val"/>
            <xsl:param name="type"/>
            <xsl:param name="copy"/>
            <xsl:if test="boolean($copy)">
                <xsl:apply-templates select="node()"/>
            </xsl:if>
            <xsl:if test="string-length($val) = 0 ">
                <exception description="Type {$type} value cannot be empty"/>
            </xsl:if>
        </xsl:template>
    </xsl:stylesheet>The 'emptyCheck' function works fine, but the space replacing is not working, this is the result after the transform:
    <?xml version="1.0" encoding="utf-8"?>
    <root insertedtime="2008-05-01T14:03:00.000+10:00" pkid="23421">
       <books>
          <book type="fiction" id="101">
             <author>John Smith</author>
             <title>Book title</title>
             <year>2 0 0 8</year>2008</book>
       </books>
    </root>The spaced year value is still there, the no-space year is added outside the 'year' tags'
    anyone can help me, your help is extremely appreciated!
    Thanks!

    You should add a template for 'year' :<xsl:template match="year">
    <year><xsl:value-of select="translate(.,' ','')"/></year>
    </xsl:template>and remove the translate call in the 'book' template.
    It would be better to add a 'priority' attribute at each template so it would be explicit which template to use because match="@*|node()" could be interpreted by another transform engine as the unique template to be used !

  • Simple Maxtor External Drive Question

    Thanks in advance for any advice anyone can share.
    I just bought and setup a Maxtor One Touch 4 Plus External Drive. I have it all set up to work with TM and everything seems to be fine.
    My question is -- should I leave the drive on 24/7 or shut it off? My Mac is normally off all day while I'm at work. I don't want to burn the drive out, but I don't really see an on/off switch on it...
    Any ideas?

    I have one left over from my PC days and was wondering if I could use it with Time Machine.
    Yes, you can, as long as you partition it with GUID or APM partition type. Instructions for them are in several places, for example
    http://www.macobserver.com/tip/2006/08/16.1.shtml - either USB or firewire drive will work for Time Machine (when partitioning, give it a short simple name with no spaces, special characters etc).

  • Simple and maybe stupid question when you have two instances

    Just a simple question, I was just wondering how to create user account on the local machine when you run two instances of oracle.For example all the commands I use to start and stop the database use the variables stored in the oracle user bash_profile.
    But do I have to create another user to manage the other instance because it should use another bash_profile with a different oracle_sid?

    Linux and Unix installations of Oracle are kind-a funny. At the end of te installation is a request to run 'root.sh'. That does a few things: set up permissions and ownerships correctly; copy some scripts into the specified directory (default /usr/local/bin).
    If you were to look at /usr/local/bin, you would notice a few files, typically with names "dbhome.sh, oraenv.sh, oraenv.csh". These are designed to set up the PATH, the ORACLE_HOME and the ORACLE_SID correctly, based on user response and information in the oratab file - which is /etc/oratab in Linux. (I always ensure there to link oraenv.sh as oraenv)
    Longer story shortened:
    Assume you use(d) dbca to create the instances. Then you can source the oraenv.sh to set up the environment:
    pop2@fuzzy:~> . oraenv.sh
    [pop2]? orcl
    pop2@fuzzy:~> env | grep -i ora
    ORACLE_SID=orcl
    PATH=/opt/oracle/product/10.2.0/server/bin:/home/pop2/bin:/usr/local/bin:/usr/bin:/usr/X11R6/bin:/bin:/usr/games:/opt/gnome/bin:/opt/kde3/bin:/usr/lib/mit/bin:/usr/lib/mit/sbin
    ORACLE_HOME=/opt/oracle/product/10.2.0/serverThat way you can switch to any known environment simply by sourcing oraenv and telling it which SID you want. It extracts the info from /etc/oratab.
    You can tell oraenv to shut up by setting ORAENV_ASK to 'NO' and setting the ORACLE_SID variable before sourcing oraenv. This is useful in .profile - for example my /etc/profile contains the followig:
    export ORACLE_SID=XE
    ORAENV_ASK=NO
    . oraenv

  • Simple Java Network Programming Question

    import java.io.*;
    import java.net.*;
    public class ConsumerClient
         private static InetAddress host;
         private static final int PORT = 1234;
         private static Socket link;
         private static Resource item;
         private static BufferedReader in;
         private static PrintWriter out;
         private static BufferedReader keyboard;
         public static void main(String[] args)     throws IOException
              try
                   host = InetAddress.getLocalHost();
                   link = new Socket(host, PORT);
                   in = new BufferedReader(new InputStreamReader(link.getInputStream()));
                   out = new PrintWriter(link.getOutputStream(),true);
                   keyboard = new BufferedReader(new InputStreamReader(System.in));
                   String message, response;
                   do
                        System.out.print("Enter 1 for resource or 0 to quit: ");
                        message = keyboard.readLine();
         if(message.equals("1")**
                             item.takeOne();**
                        //Send message to server on
                        //the socket's output stream...
                        out.println(message);
                        //Accept response from server on
                        //the socket's input stream...
                        response = in.readLine();
                        //Display server's response to user...
                        System.out.println(response);
                   }while (!message.equals("0"));
              catch(UnknownHostException uhEx)
                   System.out.println("\nHost ID not found!\n");
              catch(IOException ioEx)
                   ioEx.printStackTrace();
              finally
                   try
                        if (link!=null)
                             System.out.println("Closing down connection...");
                             link.close();
                   catch(IOException ioEx)
                        ioEx.printStackTrace();
    }

    georgemc wrote:
    BlueNo yel-- Auuuuuuuugh!
    But the real question is: What is the air-speed velocity of an unladen swallow?

  • I have a simple movie clip/ button question

    I have a simple movie clip on my scene 1 frame 1.  Inside that movie clip I have another movie clip, with a button on top that controls that mc.  Also have another movie clip with a button on top that I would like to take me back to scene 1, frame xyz.  I cannot remember how to do it.

    Well, I don't know the code to use, so I haven't tried anything unfortunately.  I havent typed code in the past couple of years, so I vaguely remember having to type in something pertaining to a _root or something like that ...here are a few screen shots, like I said, the button nested in the movie clip I need to take me back to the main page and goto a different frame.  I only have one scene, as2,
    on scene 1, the movie clip is the cube at bottom left.  inside the mc the button i need to take me back is bottom right-thanks!

  • Need a quick simple answer to this question please

    Hi all,
    Well. Today I'm going be signing a new contract with AT&T because I'm done with T-Mobile. Never have service when I need it!
    I really want to get the iPhone.
    My question is...Do I need to buy an extra package with AT&T to activate the internet and e-mail on the iPhone or can I use it right out of them box???
    I'm asking because I know with all companies you need to add that internet and e-mail package to get access.
    Thanks for the help

    When purchasing an iPhone 3G new, activation with AT&T is required at the store when the iPhone 3G is purchased, and the unlimited data plan for the iPhone 3G is required as part of the activation process.
    The cost is an additional $30/mo over your chosen calling and SMS plan, and is unlimited.
    This is AT&T'a standard unlimited data plan rate for all phones in the smart phone category regardless if such a phone is a 3G phone.

  • I cant find a simple answer to this question.

    I get this stupid error when running an applet:
    java.lang.NoClassDefFoundError: website (wrong name: website/website)
    at java.lang.ClassLoader.defineClass0(Native Method)
    at java.lang.ClassLoader.defineClass(ClassLoader.java:403)
    at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:10
    1)
    at java.net.URLClassLoader.defineClass(URLClassLoader.java:248)
    at java.net.URLClassLoader.access$1(URLClassLoader.java:216)
    at java.net.URLClassLoader$1.run(Compiled Code)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(Compiled Code)
    at java.lang.ClassLoader.loadClass(Compiled Code)
    at sun.misc.Launcher$AppClassLoader.loadClass(Compiled Code)
    at java.lang.ClassLoader.loadClass(Compiled Code)
    at sun.applet.AppletClassLoader.loadClass(AppletClassLoader.java:110)
    at java.lang.ClassLoader.loadClass(Compiled Code)
    at sun.applet.AppletClassLoader.loadCode(AppletClassLoader.java:363)
    at sun.applet.AppletPanel.createApplet(AppletPanel.java:532)
    at sun.applet.AppletPanel.runLoader(AppletPanel.java:468)
    at sun.applet.AppletPanel.run(Compiled Code)
    at java.lang.Thread.run(Compiled Code)
    i cant find a simple answer to fixing this, where hav i gone wrong?
    Below is me HTML:
    <APPLET
    CODEBASE = "C:\JBuilder3\myclasses\"
    CODE = "website.class"
    NAME = "website"
    WIDTH = 400
    HEIGHT = 300
    HSPACE = 0
    VSPACE = 0
    ALIGN = middle
    >
    </APPLET>
    below is part of me code:
    package website;
    import java.awt.*;
    import java.awt.event.*;
    import java.applet.*;
    import javax.swing.*;
    public class website extends Applet implements Runnable
    Thanks in advance

    The simple answer is that by putting your class into the package named "website", the java runtime program looks for a directory called "website", which it is apparently unable to find. Try removing the package statement and recompile.

  • Simple Bank Balance Sheet Question

    I have a simple bank balance spreadsheet.
    The headers include the following:
    Date Amount Category Cleared Balance
    The category is a pop-up list, cleared is a check list
    What formula do I use to add the total amount spent in a category, for the purpose of making a spending graph? I guess I need to "look up" the "kind" in the column and then get a sum of the amount, but I am not sure how to do this. I am sure it is simple.

    This method may not be particularly elegant but I have been using it successfully for years.
    Okay, let's assume for this example that you have Columns A through E with the headers you specified, Date, Amount, Category, Cleared, and Balance. Further, you have a pop-up menu on the cells of the Category menu. Again for this example let's assume the pop-up values are "Utilities", "Food", "Clothing", and "Other". Now you need to establish 4 columns (one for each of the menu items). Let's use columns G through J. In the header of column G, type Utilities. In the header of column H, type Food, and so forth.
    Now in cell G2 enter the following formula =IF($C2=G$1,$B2,)
    Copy the formula into cells H2 through J2 (fill right) and then copy the formula from cells G2 through J2 (fill down) down the spreadsheet to as many rows as you think you will have entries.
    What this formula does is examine the contents of the Category cell and compares it to the text in the header of the column. If they match the $ contents of Amount are copied to the new cell. So, when you get done with this you have 4 columns of mostly zeros except where the categories match. Then all you have to do is at the bottom of each of the 4 columns (possibly in the footer), sum the column and you will have the individual sums for each category.
    I hope this wasn't too confusing. There may be a more elegant way and if someone knows it maybe they will post it and I'll learn too.

  • Simple web service authentication question

    I'm using the application server included with Sun ONE Identity Server 6.1 (and Apache Axis) to deploy a very simple sample web service. Accessing it from a web browser works fine. (After entering the url to my service, I'm redirected to the authentication page. After authenticating, my service is executed as expected.)
    The problem comes when I attempt to execute this same web service from a Java application (using Apache Axis). I authenticate programmatically and have a valid SSOToken. How do I pass my authentication information along to the IS server when invoking the web service programmatically? Can I do this somehow with the SSOToken I have? Every time I invoke the service programmatically, a "(302)Moved Temporarily" HTML response is received.
    Thanks for your help.
    David

    This solved the problem for me (using Axis):
         call.setProperty(org.apache.axis.transport.http.HTTPConstants.HEADER_COOKIE,
                          "iPlanetDirectoryPro=" + token.getTokenID().toString());
         call.setMaintainSession(true);Hope this helps.

  • A simple, but slightly stupid, question...

    Hi all
    How do I copy from my IPOD to my computer hard drive.
    Thought it was just a drag and drop, but that doesn't seem to be doing the trick.
    Thanks for the help.

    Remember there are no stupid questions, only stupid answers.
    I use Yamipod to do this. There are other programs but I think Yamipod is best
    http://www.yamipod.com/main/modules/home/

  • Simple OS 9 upgrade question

    I am running an IMac on 8.6 and need to upgrade to 9 to install a new printer. Even tho I live in the US, I bought the computer in the UK so it has UK English 8.6 OS on it. I have purchased the OS 9 install disc from a reseller here in the States but it's telling me that it can only install on top of the US English version. So, at the risk of sounding ignorant or lazy, where in the UK is the best place to purchase an OS 9 installation disc for immediate shipping? I've Googled about a zillion UK Mac resellers and no one seems to have it. Thanks.

    Hi, dandy -
    If you do not have a record of the serial numbers of some software, you may then need to move the preference file(s) for it over to the new System Folder. IF you do have a record of those, it is a simple matter to re-enter them when you run the software the first time in the new OS. For that reason, I make it a habit to note the serial number for any software that needs such inside the manual for the software, so I always have a hard copy of it.
    Some software (QuickTime is one such) will display its registration/serial number in its preferences or elsewhere, from where it can be copied.
    With a clean install, will I have to reinstall software or is it only extensions and drivers associated with software etc that will disappear? It appears from the article you linked and from other sources that I can drag and drop the extensions from the old folder to the new but it would ease my mind greatly if you would just confirm that.
    It is usually just extensions, possibly a control panel or two - those can usually be just dragged over to the new System Folder.
    However, it may also be necessary to move browser data and email data over to the new System Folder.
    Netscape usually keeps all of its stuff in a folder named Netscape Users in the Preferences folder.
    Internet Explorer keeps its files in a folder named Explorer in the Preferences folder.
    Outlook Express is a bit different - older versions kept the email archive files in the Outlook Express folder; newer versions running in OS 9 keep those files in the Documents folder that is created by an OS 9 install, here - (hard drive) >> Documents >> Microsoft User Data >> Identities. In the Identities folder will be a folder for each account (identity); the default one is named Main Identity. These separate folders contain the email archive files for each account.
    If you've added extra fonts, you will need to also move those.
    When moving items from the old System Folder to the new one, be sure to not move any extensions or control panels which belong to OS 8.6; such can contaminate an OS 9 install and cause problems.

  • Simple (?) JRE installation question

    Java / Control Panel states current version is 1.6.0 (build 1.6.0_03-b05).
    I am cleaning up the Norton Internet Security 2005 Program Control list (list of programs that access Internet and how Norton controls that access) in anticipation of re-installing Norton Internet Security 2005; hopefully to correct a problem with CCAPP.EXE dying unexpectedly and killing POP3 email service access.
    I found six (6) Sun / Java related entries:
    Sun Microsystems Java 2 Platform Standard Edition Automatic Multiple
    C:\Program Files\Java\jre1.6.0_01\bin\jusched.exe
    Sun Microsystems Java Update Checker Automatic Multiple
    C:\Program Files\Java\jre1.6.0_01\bin\jucheck.exe
    Sun Microsystems Java Update Checker Automatic Multiple
    C:\Program Files\Java\jre1.5.0_10\bin\jucheck.exe
    Sun Microsystems Java Update Checker Automatic Multiple
    C:\Program Files\Java\jre1.5.0_09\bin\jucheck.exe
    Sun Microsystems Java Update Checker Automatic Multiple
    C:\Program Files\Java\jre1.5.0_06\bin\jucheck.exe
    Sun Microsystems Java Update Checker Automatic Multiple
    C:\Program Files\Java\jre1.5.0_05\bin\jucheck.exe
    Several questions.
    1. Do we need all the earlier version JUCHECK.EXE entries?
    2. Why doesn't 1.6.0_03 have JUCHECK.EXE / JUSCHED.EXE / JUREG.EXE(?) entries?
    Thanks.

    Well, actually that was only half the question.
    Do we need the older versions in the Internet Access Control list?
    Does anyone really know what time it is?
    ;-)

Maybe you are looking for

  • Upload excel data into Internal table dynamically

    Hi all, I have a excel file, in this file there are fixed columns but I don't know, at run time, how many rows will come up. Now I want to fetch the data from file to internal table, I used GUI_UPLOAD and ALSM_EXCEL_TO_INTERNAL_TABLE. But it is not w

  • App disappeared prior to finishing download, can't access it

    In the middle of downloading facebook app, and the app just disappeared.  When I tried to download it again, it showed that it was already installed.  Can't use it or uninstall to download again.  Please help.  Thanks.

  • Looping audio on the menu page

    I have edited a piece of audio for use on the menu page of an iDVD project. It is cropped, so that when it loops, there is a natural transition from the end of the clip to the beginning, as it starts over. I imported this clip into my iDVD project, a

  • [SOLVED] Problem launching rxvt-unicode

    $ rxvt-unicode bash: rxvt-unicode: command not found $ pacman -Q rxvt-unicode rxvt-unicode 9.10-1 PS: I'm having to type all this since copying from xterm refuses to work... Last edited by NoobCp (2011-04-10 18:45:01)

  • 10.4.11 update problems

    Yesterday I installed the software update for Tiger. From that moment on, I have had serious problems: 1. The screen was very dark. When I went to system preferences/display, I was able to brighten the screen, but the text jumped to very large and no