Dynamic invocation of javac with custom class path.

To all the Java Gurus out there,
Consider the following classes:
XYZ/test/TestUtil.java
package test;
class TestUtil {
  void useMe() {
}ABC/test/Test.java
package test;
public class Test {
  public static void main(String[] args) {
    TestUtil t = new TestUtil();
     t.useMe();
}The class Test uses package private access to the TestUtil.useMe() method. Then the Test class is packaged into test.jar and the TestUtil class is packaged into testutil.jar.
Our application uses a custom class loader architecture where the test.jar is loaded by class loader "X" and testutil.jar is loaded by class loader "Y". Also Y is the parent class loader of X. When the main() of Test class is run it results into IllegalAccessException as the package private method is being accessed from different class loaders.
We are currently using a dynamic way to detect the dependency between test.jar and testutil.jar and generating the classpath argument to the "javac" ant task which dyncamically invokes the sun.tools.javac.Main class. So while compiling Test class the following command line is generated:
javac -classpath XYZ/testutil.jar Test.java
It compiles fine assuming that the Test class and the TestUtil class are loaded by the same class loader but at runtime this fails.
Is there a way to make "javac" use our runtime class loader architecture to instead of static classpath, so that the access violation is captured at compile time?
Any help is appreciated.
Ravi
PS: If this is not the right forum please point me to the right place to post this questions.

Not that I'm aware of - the Java Language is designed to be platform-independent so absolute file paths which is a specific feature of various file systems would naturally not to be mixed up with the object-oriented hierarchy structure.
Just like a compiler wouldn't check if a file exists in
new File("<FilePath>")I don't think you can get compile-time checks for what you have wanted.
Hope this helps~
Alex Lam S.L.

Similar Messages

  • Can I dinamicly load a class with custom class loader ?

    Can I dinamicly load a class with custom class loader ?

    Hi,
    I was wondering if you found answer to your question, and also were you using your custom class loader inside a signed applet as I am in a similar situation, and was wondering if you could help me. An example would be great...
    Thanks a lot.
    Regards.

  • Add button to a datagrid with custom class

    Hi.
    I have a custom class that i put in the dataprovider to a datagrid. And when i column with buttons i get the following error.
    ReferenceError: Error #1069: Property null not found on COMPONENTS.Output.OutputFile and there is no default value.
    at mx.controls::Button/set data()[E:\dev\3.0.x\frameworks\projects\framework\src\mx\controls\Button.as:873]
    at mx.controls::DataGrid/http://www.adobe.com/2006/flex/mx/internal::setupRendererFromData()[E:\dev\3.0.x\framework s\projects\framework\src\mx\controls\DataGrid.as:1646]
    at mx.controls::DataGrid/commitProperties()[E:\dev\3.0.x\frameworks\projects\framework\src\m x\controls\DataGrid.as:1606]
    at mx.core::UIComponent/validateProperties()[E:\dev\3.0.x\frameworks\projects\framework\src\ mx\core\UIComponent.as:5670]
    at mx.managers::LayoutManager/validateProperties()[E:\dev\3.0.x\frameworks\projects\framewor k\src\mx\managers\LayoutManager.as:519]
    at mx.managers::LayoutManager/doPhasedInstantiation()[E:\dev\3.0.x\frameworks\projects\frame work\src\mx\managers\LayoutManager.as:669]
    at Function/http://adobe.com/AS3/2006/builtin::apply()
    at mx.core::UIComponent/callLaterDispatcher2()[E:\dev\3.0.x\frameworks\projects\framework\sr c\mx\core\UIComponent.as:8460]
    at mx.core::UIComponent/callLaterDispatcher()[E:\dev\3.0.x\frameworks\projects\framework\src \mx\core\UIComponent.as:8403]
    What shuld i do?
    Thanks for help.

    If you are talking SE54 and Maintenance Views, when I do an SM30 on the Maintenance View and do SYSTEM->STATUS, I see GUI STATUS ZULG on program SAPLSVIM.  If you look at that status, I see two buttons with dynamic text.  The first one is call GPRF and has dynamic text VIM_PR_STAT_TXT_CH.  You can find a suitable PBO event to set the text of that function code and if that works, find a suitable PAI event to respond to that function.
    I recall finding some documentation on customizing the GUI STATUS but no luck today trying to find it.
    Let us know how it goes.

  • How to create a ActiveX Object with custom classes

    Hi
    I am trying to create a Active X object for some of the work I have done in Java to be used with VB, but I cannot get the Active X object to generate and it always come up with the following error:
    Exception occurred during event dispatching:
    java.lang.NoClassDefFoundError: uk/co/agena/minerva/model/Model
    at java.lang.Class.getMethods0(Native Method)
    at java.lang.Class.getDeclaredMethods(Unknown Source)
    at java.beans.Introspector$1.run(Unknown Source)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.beans.Introspector.getPublicDeclaredMethods(Unknown Source)
    at java.beans.Introspector.getTargetEventInfo(Unknown Source)
    at java.beans.Introspector.getBeanInfo(Unknown Source)
    at java.beans.Introspector.getBeanInfo(Unknown Source)
    at sun.beanbox.JarInfo.<init>(Unknown Source)
    at sun.beanbox.JarLoader.createJarInfo(Unknown Source)
    at sun.beanbox.JarLoader.loadJar(Unknown Source)
    at sun.beans.ole.Packager.loadBean(Unknown Source)
    at sun.beans.ole.Packager.generate(Unknown Source)
    at sun.beans.ole.Packager.actionPerformed(Unknown Source)
    at java.awt.Button.processActionEvent(Unknown Source)
    at java.awt.Button.processEvent(Unknown Source)
    at java.awt.Component.dispatchEventImpl(Unknown Source)
    at java.awt.Component.dispatchEvent(Unknown Source)
    at java.awt.EventQueue.dispatchEvent(Unknown Source)
    at java.awt.EventDispatchThread.pumpOneEventForComponent(Unknown Source)
    at java.awt.EventDispatchThread.pumpEventsForComponent(Unknown Source)
    at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
    at java.awt.EventDispatchThread.run(Unknown Source)
    This appears to be beacuse the class uk/co/agena/minerva/model/Model is a custom class which is based on the software I am using. Does anyone know how I can get around this issue. I have tried incluijng those class files for the custom classes within the jar file, but I continue to get the same issue?
    Any help would be gratefully received.
    Thanks
    Angie

    This error is no longer coming up, it is now saying that it has an unsupported class version error. I believe this may be because the class file and library files have been complied under different versions, is there a method to check this?

  • Replace Standard Class with Custom Class

    Hi,
    I have a query that i need to do changes in Standard Class, but i dont want to do changes Standardly. Is there any other way to replace the Standard Class to Custom Class.
    Please Guide me so that i wont change the Standard Class but i can replace it with "Z" Class.
    Thanks & Regards,
    Harkesh Dang

    Hi,
    I think u will have to go to transaction se24 .select ur class there copy it to a Z class and then make this Z class as the superclass of this.
    Not sure how this Z class will get incorporated in the framework.
    Thanks and Regards
    Shilpi

  • Subclass UIScrollView with Custom Class

    I want to use my custom class "ImageGridView" (subclass of UIScrollView) in Interface Builder.
    Here is what I have done:
    1) Dragged a UIScrollView onto my main view in IB.
    2) Changed the new UIScrollView Class Identity to "ImageGridView" which autocompleted so I thought it should work if it found it no prob.
    3) Placed an NSLog(@"HIT") in the init of the ImageGridView code.
    4) Also tried debugging break in the ImageGridView
    No luck....i can't get the custom class to instantiate .....no code is even run in that class.

    Don't forget that the class will be instantiated within Interface Builder and 'saved' within the NIB. At runtime it is unsaved with all of the initialised parameter values intact.
    Try using the 'viewDidLoad' (??I think this is the name - going by memory here) method which is called after the view has been restored from its saved state in the NIB.
    Susan

  • Loading resources with customized class loader

    I have a customized classloader that keeps classes and resources in a table in byte[] form. It works fine as far as loading classes go, I just call defineClass with the byte array corresponding to the class. My problem is how to load resources. I already have the resource data in the table, which you'd think would be a good thing, but the method that has to be overridden (getResource or findResource) is supposed to return an URL to the resource. The only way I can think of to do that is to write the data to a file and return an URL to that file, but I don't even wanna touch that solution with a nine foot stick. Surely there must be a better way!?

    Usually, when your resources are in a custom source, you create and implement your own URL protocol (like jar:). This is done by creating your own java.net.URLStreamHandler and java.net.URLConnection implementations. You can peruse the jar implementation in sun.net.www.protocol.jar as a good example.
    Once you have your own protocol that knows how to get to your resource file and how to identify and extract a resource, you simply use that protocol in the URLs returned by your ClassLoader. The resource URLs can then be used as you would normally use any URL.
    A tutorial describing how all of this works, and how to implement your own is at:
    http://developer.java.sun.com/developer/onlineTraining/protocolhandlers/
    I hope you find this of some help.

  • Don't get WCF with custom Class working

    Hey
    I am starting with playing around with WCF. But I don't get it working. I can't see my Problem and this since a few days...
    So, I will explain in Detail, what I did so far.
    I created a blank ASP.NET Project (VS 2013)
    Within I created 2 files
    The first file is the Contract Interface
    mports System.ServiceModel
    Namespace DataClasses
    <ServiceContract> _
    Public Interface ITestService
    <OperationContract> _
    Function ReturnClass() As List(Of TestDataClass)
    End Interface
    End Namespace
    Ok, the second is the TestDataClass
    Imports System.Data.Services.Common
    Imports System.Runtime.Serialization
    Namespace DataClasses
    <Serializable> _
    <DataContract> _
    Public Class TestDataClass
    <DataMember> _
    Public Property Id As Long
    <DataMember> _
    Public Property Firstname As String
    <DataMember> _
    Public Property Lastname As String
    End Class
    End Namespace
    Ok. - The next Thing, I was doing is to create the "returning" information
    Imports System.ServiceModel.Web
    Namespace Proxy
    Public Class TestData
    Implements DataClasses.ITestService
    Public Function ReturnClass() As List(Of DataClasses.TestDataClass) Implements DataClasses.ITestService.ReturnClass
    Dim retList As New List(Of DataClasses.TestDataClass)
    retList.Add(New DataClasses.TestDataClass With {.Firstname = "My", _
    .Id = 2, _
    .Lastname = "Name"})
    Return retList
    End Function
    End Class
    End Namespace
    Ok - So far, as I understood, This should be all correct. (I hope)
    The next, I did was to add a WCF Data Service 5.6 file
    Within this file I changed the code to this:
    Imports System.Data.Services
    Imports System.Data.Services.Common
    Imports System.Linq
    Imports System.ServiceModel.Web
    Public Class DataModelWcf
    Inherits DataService(Of Proxy.TestData)
    ' This method is called only once to initialize service-wide policies.
    Public Shared Sub InitializeService(ByVal config As DataServiceConfiguration)
    config.SetEntitySetAccessRule("*", EntitySetRights.AllRead)
    'config.SetServiceOperationAccessRule("*", ServiceOperationRights.All)
    config.DataServiceBehavior.MaxProtocolVersion = DataServiceProtocolVersion.V2
    End Sub
    End Class
    OK. - When I now test the Service by clicking on it and run in browser, I get the following:
    <?xml version="1.0" encoding="UTF-8" standalone="true"?>
    -<service xmlns="http://www.w3.org/2007/app" xmlns:app="http://www.w3.org/2007/app" xmlns:atom="http://www.w3.org/2005/Atom" xml:base="http://localhost:1523/DataModelWcf.svc/">
    -<workspace>
    <atom:title>Default</atom:title>
    </workspace>
    </service>
    OK - The Service itself runs. - But I don't get any "Operation". I can't see my failure. - I tested around for the last few days, but I don't have a Clou, what's wrong...
    I also added a Service into the config file (but don't think, that this will make some differences)
    <system.serviceModel>
    <services>
    <service name="WCF_Test.Proxy.TestData">
    <endpoint address="" contract="WCF_Test.DataClasses.ITestService" binding="basicHttpBinding"/>
    <endpoint address="mex" contract="IMetadataExchange" binding="mexHttpBinding"/>
    </service>
    </services>
    <serviceHostingEnvironment aspNetCompatibilityEnabled="true" />
    </system.serviceModel>
    So, thanks for every Little hint to solve this.
    THX - Have  nice Weekend!

    Hello Zero-G. _,
    >> But I don't get any "Operation". I can't see my failure. - I tested around for the last few days, but I don't have a Clou, what's wrong...
    I am afraid that you have mixed the WCF and WCF Data Service, here is a WCF Service example(it works with the Entity Framework while it is not WCF Data Service):
    http://www.codeproject.com/Articles/127395/Implementing-a-WCF-Service-with-Entity-Framework, please check it, in your case, you are use this mode and you do not need to create WCF Data Services.
    If you want to write a custom method in WCF Data Service, you could refer to this link:
    https://msdn.microsoft.com/en-us/library/dd744841(v=vs.110).aspx, as you can see, although if we declare a custom method, it would not show in the web browser, we call it as adding
    the method after the based service link directly:
    http://localhost:12345/Northwind.svc/GetOrdersByCity
    Or call it by using a client project which could detect this method and call it as in this blog:
    http://blogs.msdn.com/b/dataaccesstechnologies/archive/2009/12/01/way-to-expose-custom-method-in-an-entity-class-from-wcf-data-service.aspx
    Regards,
    Fred.
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • Std::list::sort() doesn't work with custom class

    The following example doesn't order a list the way I'd expect. Is this being done wrong? Sun Studio 12 (not update 1). Current patches as of Monday.
    #include <list>
    class CMyClass
    public:
    CMyClass(long a) : m_Sec(a) { }
    bool operator<(const CMyClass* rhs)
    return (m_Sec < rhs->m_Sec);
    long m_Sec;
    typedef std::list<CMyClass*> TLogList;
    int
    main(int argc, char* argv[])
    TLogList logList;
    CMyClass* name = new CMyClass(0x4A833E79);
    logList.push_back(name);
    name = new CMyClass(0x4A85E144);
    logList.push_back(name);
    name = new CMyClass(0x4A85E66F);
    logList.push_back(name);
    name = new CMyClass(0x4A85E66F);
    logList.push_back(name);
    name = new CMyClass(0x4A85B2C2);
    logList.push_back(name);
    name = new CMyClass(0x4A85D6EF);
    logList.push_back(name);
    name = new CMyClass(0x4A69F9AD);
    logList.push_back(name);
    name = new CMyClass(0x4A85DC92);
    logList.push_back(name);
    name = new CMyClass(0x4A817316);
    logList.push_back(name);
    name = new CMyClass(0x4A85DEEB);
    logList.push_back(name);
    name = new CMyClass(0x4A846329);
    logList.push_back(name);
    name = new CMyClass(0x4A85E39D);
    logList.push_back(name);
    name = new CMyClass(0x4A85D41D);
    logList.push_back(name);
    name = new CMyClass(0x4A89CC17);
    logList.push_back(name);
    name = new CMyClass(0x4A85DC19);
    logList.push_back(name);
    logList.sort();
    TLogList::iterator logListIter = logList.begin();
    TLogList::iterator logListEnd = logList.end();
    for (; logListIter != logListEnd; ++logListIter)
    CMyClass* name = *logListIter;
    cout << hex << name->m_Sec << endl;
    return 0;
    which produces
    4a833e79
    4a85e144
    4a85e66f
    4a85e66f
    4a85b2c2
    4a85d6ef
    4a69f9ad
    4a85dc92
    4a817316
    4a85deeb
    4a846329
    4a85e39d
    4a85d41d
    4a89cc17
    4a85dc19

    The program as you wrote it will sort the contents of the list. The list consists of the addresses of CMyClass objects, and after sorting, will contain those addresses in sorted order.
    If you want to sort by the contents of the classes that are pointed to, you need to provide a comparison operator that compares the contents, and use the other form of the list::sort function that takes a comparison function as an argument. That is, add the function
    bool comp(const CMyClass* l, const CMyClass* r)
       return l->m_Sec < r->m_Sec;
    }and change
    logList.sort(); to
    logList.sort(comp); This version of list::sort will not compile using the default libCstd, because it requires member templates in the library implementation. For more information about this limitation, refer to the C++ FAQ section on library compatibility.
    [http://developers.sun.com/sunstudio/documentation/ss12u1/mr/READMEs/c++_faq.html#LibComp]
    The revised code will compile with the optional STLport library, or with other 3rd-party libraries like Apache stdcxx. To use STLport, add the option -library=stlport4 to every CC command, compiling and linking. You cannot mix code compiled for the default libCstd with STLport code in the same program.

  • Dynamic RT not available with custom resolutions?

    I want to run a sequence that is 1000 x 1000 pixels but when I choose this in my RT tab in the sequence timeline all the RT options arnt there...
    It does work however with other standard resolutions..
    Is there a reason for this?
    Thanks.

    The way the application is engineered would make it impossible to have dynamic RT available for every possible frame resolution. The application provides it for all industry standard video formats. Though FCP is resolution independent it cannot give dynamic RT at all frames dimension.

  • Jar: Manifest-Attribute "Class-Path"

    I've got a problem with the Class-Path-attribute of the JARs manifest-file. So I've written a real simple application to test where the problems occure... but even this trivial app does not work!
    The execution starts at "Starter.java":
    public class Starter{
          public static void main(String args[]){
                packageOne.Caller.callWriter();
    }The class "Caller" is in a JAR ("Caller.jar") in the same directory as Starter.java.
    Caller.java:
    package packageOne;
    public class Caller{
          public static void callWriter(){
                packageTwo.Writer.write("Write this");
    }The class "Writer" is in a JAR ("Writer.jar") in the same directory as Starter.java and Caller.jar.
    Writer.java:
    package packageTwo;
    public class Writer{
          public static void write(String message){
                System.out.println(message);
    }The file Caller.jar consists of Caller.class and the Manifest.mf. The package-structur/the path seams to be all right.
    The file Writer.jar consists of Writer.class and the Manifest.mf. The package-structur/the path seams to be all right.
    If I invoke the Starter with:
    java Starter -classpath Caller.jar;Writer.jareverything's fine.
    Now, I added the following line to the Manifest.mf of Caller.jar:
    Class-Path: Writer.jar(with one empty line between Manifest-Version: 1.0 and the new line.
    So... shouldn't it be possible now, to invoke the application with:
    java Starter -classpath Caller.jar ???
    It doesn't work. So: what have I misunderstood?
    (The error message is:
    Exception in thread "main" java.lang.NoClassDefFoundError: packageTwo/Writer
          at packageOne.Caller.callWriter(packageOne/Caller.java:5)
          at Starter.main(Starter.java:3)

    Hmmm, I tested it and here are the command I ran and their results. Try doing the same on your computer:aleph% mkdir packageOne
    aleph% mkdir packageTwoThat created the directories.aleph% cat > Starter.java
    public class Starter{
          public static void main(String args[]){
                packageOne.Caller.callWriter();
    aleph% cat > packageOne/Caller.java
    package packageOne;
    public class Caller{
          public static void callWriter(){
                packageTwo.Writer.write("Write this");
    aleph% cat > packageTwo/Writer.java
    package packageTwo;
    public class Writer{
          public static void write(String message){
                System.out.println(message);
    }That created the source files: Starter.java in the current directory, Caller.java under packageOne and Writer.java under packageTwo. Next the compiling and creating the manifest file:aleph% javac Starter.java
    aleph% cat > MF
    Class-Path: Writer.jarThat created additional info to be included in manifest file and put it in a file called MF.
    Then I package "caller.jar" with the manifest and "Writer.jar" without it:aleph% jar -cmf MF caller.jar packageOne
    aleph% jar -cf Writer.jar packageTwoDelete the package* directories so java wont get confused...aleph% rm -r package*And finally run the thing. Remember that the path separator is : in unix but ; in DOS, if that is what you are using.aleph% java -cp .:caller.jar Starter
    Write thisNo problems anywhere. What are the steps you did?

  • Lost on the Class Path

    I'm having some serious trouble with class package path issues ... ugh!
    I've downloaded a fairly complex and well programmed FLA file and other source files in AS 3.0, and just started to adapt it for a custom application.  When I published the FLA and packages in FLash CS3, everything worked perfectly.  Then I just got Flash CS4 a few days ago, and so opened the same application in CS4, and also published it fine.  Yet, once I started to make some very simple customizations, such as create a new MovieClip, and then added "linkage" to the MovieClip in the library, the trouble started. Getting the new external class to associate to the new MovieClip was not working (although it was in the same location as the other package file, with the same class package designation), so of course I went to take a look at the preferences and set the general class path.  Interestingly, the class path was completely blank (I just installed CS4 that day).  Yet then, why was the application still working initially with no class path set?  All of your original classes were loading fine, and the application was working.  So, then when I went into actually set a class path (my new class is in the same folder: .../com/parkerandkent/components/classic/photogallery ), I start getting all kinds of errors ... and now, even if I revert back to having no class path at all, the application does not work at all (when it originally did with no class path at all).  Strange!  I am very confused about what is going on.
    There are 5 primary .as package files, all of which are linked to MovieClips in the Library:
    ClassicPhotoGallery.as
    Photo.as
    Thumb.as
    Thumbs.as
    CallTag.as (the new class)
    I've checked the properties linkage for each of these, and they all appear correct also.
    Currently, I have all of these class paths set:
       - "/Users/mac/_EXTRA/ArtMuse/GALLERY"
       - " "/Users/mac/_EXTRA/ArtMuse/GALLERY/com/parkerandkent/components/classic/photogallery"
    Currently, I get these these error messages, which are referring to only 3 of 5 total .as files (which are all in the same location, and all have the same class path designation - and none of these files is the new class I made, which now appears to be referenced okay).
    Photo.as Line 1:
    5001: The name of package 'com.parkerandkent.components.classic.photogallery' does not reflect the location of this file. Please change the package definition's name inside this file, or move the file. /Users/mac/_EXTRA/ArtMuse/GALLERY/com/parkerandkent/components/classic/photogallery/Photo .as
    Thumb.as Line 1:
    5001: The name of package 'com.parkerandkent.components.classic.photogallery' does not reflect the location of this file. Please change the package definition's name inside this file, or move the file. /Users/mac/_EXTRA/ArtMuse/GALLERY/com/parkerandkent/components/classic/photogallery/Thumb .as

    Again, the class path package designation is the same for all 5 .as files:
    package com.parkerandkent.components.classic.photogallery {
    yet the application is not working, and I get only those errors posted above.
    If I remove all source path designations, then I get NO error messages, and yet the application does not work (although, I swear it was working this way originally).

  • Need help calling and looping custom classes

    Hi, I am writing a code with custom classes in it and another program that calls upon all of the classes in the first program. I can get the second one (L6) to call upon and execute all of the classes of the first (Foreign). However, I need the second one to loop until quit is selected from the menu on Foreign and I can't seem to figure out how to do it. Here are the codes:
    L6:
    public class lab6
    public static void main(String[] args)
    Foreign camount = new Foreign();
    camount = new Foreign();
    camount.get();
    camount.print();
    camount.intake();
    camount.convert();
    camount.vertprint();
    System.out.println(camount);
    Foreign:
    import java.util.Scanner;
    public class Foreign
    private String country;
    private int choice;
    private float dollars;
    private float conversionValue;
    private float conversionAmount;
    public Foreign()
    country = "null";
    choice = 0;
    dollars = 0;
    conversionValue = 0;
    conversionAmount = 0;
    public void get()
         Scanner Keyboard = new Scanner(System.in);
              System.out.println("Foreign Exchange\n\n");
    System.out.println("1 = U.S. to Canada");
    System.out.println("2 = U.S. to Mexico");
    System.out.println("3 = U.S. to Japan");
    System.out.println("4 = U.S. to Euro");
    System.out.println("0 = Quit");
    System.out.print("\nEnter your choice: ");
    choice = Keyboard.nextInt();
    public void print()
    System.out.print("\nYou chose " + choice);
    public void intake()
         Scanner Keyboard = new Scanner(System.in);
              if (choice >= 1 && choice <= 4)
    switch (choice)
              case 1: System.out.println("\nU.S. to Canada");
                        conversionValue = 1.1225f;
                        country = ("Canadian Dollars");
                        break;
              case 2: System.out.println("\nU.S. to Mexico");
                        conversionValue = 10.9685f;
                        country = ("Mexican Pesos");
    break;
              case 3: System.out.println("\nU.S. to Japan");
                        conversionValue = 118.47f;
                        country = ("Japanese Yen");
    break;
              case 4: System.out.println("\nU.S. to Euro");
                        conversionValue = 0.736377f;
                        country = ("European Union Euros");
    break;
                   System.out.print("\nEnter U.S. dollar amount: ");
              dollars = Keyboard.nextFloat();
    public void convert()
    conversionAmount = conversionValue * dollars;
    public void vertprint()
    System.out.println("\nCountry = " + country);
    System.out.println("Rate = " + conversionValue);
    System.out.println("Dollars = " + dollars);
    System.out.println("Value = " + conversionAmount);
    public String toString()
    String line;
    line = "\n" + country + " " + conversionValue + " " + dollars + " " + conversionAmount;
    return line;
    I appreciate any help anyone can give me. This is driving me crazy. Thanks.

    1. first you need to write method to get choice value from Foreign class.
    simply add this method.
       public class Foreign {
          // ... Add this
          public int getChoice() {
             return choice;
       }2. Then in your main, you can obtain with previos method.
    public static void main(String[] args) {
       Foreign camount = new Foreign();
       // remove this. you alredy create an instance in last statement.
       //camount = new Foreign();
       int choice = 0;
       do {
          camount.get();
          choice = camount.getChoice();
          // your process...
       } while (choice != 0);
    }

  • Java 5.0 does not recognize wrapped Class-Path in Manifest.MF of .jar file?

    Java: build 1.5.0_05-b05
    Ant: 1.6.2
    I use Ant <jar> task to create a standalone application in a .jar file. I have a very long "Class-Path" in the Manifest.MF file. The long Class-Path is wrapped at every 70th character by the <jar> task. I cannot run "java -jar <the jar file>", because Java runtime cannot find classes.
    I found the following Q&A from ANT's FAQ page,
    Q: Whenever I use the Ant jar or manifest related tasks, long lines in my manifest are wrapped at 70 characters and the resulting jar does not work in my application server. Why does Ant do this?
    A: Ant implements the Java Jar file specification. Please refer to the notes section where it discusses the maximum allowable length of a line and the concept of continuation characters.
    If a jar file produced by Ant does not work in your appserver, and that failure is due to the wrapped manifest, then you need to consult your appserver provider, as it is a bug in their appserver. Far more likely, however, is a problem in your specification of your classpath. It is not Ant's wrapping of your classpath that is the problem.
    Do not raise a bug about this issue until you have checked to ensure that the problem is not due to your classpath specification.
    Any idea?

    "will be searched ALSO."...
    From: http://java.sun.com/docs/books/tutorial/ext/basics/load.html
    Understanding Extension Class Loading
    The extension framework makes use of the new class-loading mechanism in the JavaTM 1.2 platform. When the runtime environment needs to load a new class for an application, it looks for the class in the following locations, in order:
    1. Bootstrap classes: the runtime classes in rt.jar and internationalization classes in i18n.jar.
    2. Installed extensions: classes in JAR files in the lib/ext directory of the JRE.
    3. The class path: classes, including classes in JAR files, on paths specified by the system property java.class.path. If a JAR file on the class path has a manifest with the Class-Path attribute, JAR files specified by the Class-Path attribute will be searched also.
    [snip]

  • Referencing between custom classes

    Hi,
    I need some help with the theory of referencing between custom class files.
    I have not worked much with custom classes before, but want to learn more.
    Is it possible to call for a function in one custom class file from another custom class file?
    The files are in the same package (folder).
    The first custom class is the one stat starts all the main activities on the movie clip when it is added to the stage.
    One of the activities it should start, is starting to add some movie clips to the stage.
    I would like to initiate that activity in the first custom class file, but have the detailed code (where, what and when to add) in another custom class file.
    Is that possible? When yes, how should it be referenced?
    Many thanks in advance!

    Hi,
    Thank you all for your replays.
    Got some new terminology – Singelton, Setters and Getters.
    Have not come across before:)
    I do know the inheritance and have used it. And my little experience with it told me as well – it’s something you shouldn’t go crazy or fanatic with. Overusing it makes things complicated.
    Amy, what you descibed is how I normally do use the classes – attach them to the Library symbols.
    In my question I meant one concrete Movie Clip which is one sub-part of the application.
    The Movie Clip is just an animated picture. That Movie Clip (girlSwim) is attached to the base class GirlSwim.
    And that class is at the moment handling the animation for that girl swimming. It would be good to have that code on a sub-level symbol, like the Girl, but as a mask is swimming along as well, it got too complicated for me to code, cross reference the nested symbols. So the code ended up on top level symbol.
    In that Movie Clip are other animating symbols as well and they are all handled with other custom classes.
    When the girlSwim Movie Clip is activated, it’s on screen, dragonflies start to fly in and fishes start to swim in as well. They are not on the original picture, so not on stage.
    And adding them is managed with timers and it continues as long as the Movie Clip is on screen.
    At the moment I have all the stuff related to dragonflies and fishes on the first keyframe.
    And it all functions nicely.
    But as I’m practicing now using class files and keeping my timeline action script free (except some stop and goto staff to handle the timeline animations), I want to get that part of the code into class file as well.
    I could but it all into the class GirlSwim and it would function.
    But as the animation code for the girl is long enough, I though it would be good to have the code for dragonflies and fishes separate.
    But it needs to be initiated by the GirlSwim class.
    So … in my little-simple world I thought the following could work .. but it didn’t:)
    1180: Call to a possibly undefined method timerStartDragonflies.
    package
    public class GirlSwim extends MovieClip
          public function GirlSwim()
               timerStartDragonflies ();
    package
    public class Dragonflies extends MovieClip
    public function Dragonflies ()
                                    //empty
                    internal function timerStartDragonflies():void
                                   //code for starting timer
                    etc.
    Is something like that possible or should I put it all into the GirlSwim class?

Maybe you are looking for

  • T42 problems

    Beginning to get frustrated with this laptop now, shame as to start with it was brilliant and I recommended it to everyone and even purchased some for the company. Having had my hard drive fail this year already I lost a lot of my work and informatio

  • Help compiling with .class files

    I am using JGrasp and I am trying to compile a program that uses .class files instead of the .java files, but JGrasp will not recognize these at compile time. How do I get my program to compile with these .class files?

  • How to install the Oracle ODBC driver for all NT users

    I need to schedule a task on a SQL server running on NT to access an Oracle DB. I have installed the Oracle ODBC driver on it and it is working well under my NT account. But the SQL scheduler runs on another NT account and the task failed. How is it

  • JDialog daughter blocks my GUI at setVisible time

    Hi, b4 any thing, I open this new topic because a friendly moderator suggested me to move from an old one which is about to be closed. Ok let's go. My situation is that I have a class StandByDialog which extends from JDialog. Ok such dialog means to

  • When updating windows 7 i get error code 80072ee2. What is it and how do i fix it?

    When updating windows 7 I get the following response: Windows could not search for updates An error occurred while checking for updates for your computer error(s) found code 80072ee2 windows encountered an unknown error click here to get help with th