To use my class files in my applications

Hi all!
public class Count
private int serialNumber;
private static int counter=0;
public static int getTotalCount()
return counter;
public Count()
counter++;
serialNumber=counter;
public class TestCounter
public static void main(String args[])
System.out.println("Number of counter is " +Count.getTotalCount());
Count c1=new Count();
System.out.println("Number of counter is " +Count.getTotalCount());
As you see above i want to use my count class in the TestCounter class but i cant compile it.It says i cant find the count class.How can i use count class in my TestCounter class.
I try to make a package.So i put the counter class to a new package and import it by this package name in the TestCounter but i says there is no class in import.How can i make a package that i can import in my other applications.

Sorry, I somehow got the impression that you could compile but not run...
You must be making a small, irritating, frustrating mistake somewhere since the settings you desrcribe are correct.
The code for the Count class is in c:\java\Count.java?
The code for the TestCount class is in c:\java\TestCount.java?
Can you compile Count with:
c:\java>javac Count.java
And after that TestCount with
c:\java>javac TestCount.java
If not, what is the exact error message (with line numbers and stuff) you get?What if you try compiling with
c:\java>javac *.java
Or "javac -classpath . *.java"?
You are using a 1.2+ jdk, right? Not those 1.1 ones? As the 1.1 jdks require some extra setting in the classpath - the compiler may not be finding the superclass of Count, java.lang.Object, and then saying it can't find Count... older jdks have a 'feature' like that.
Let's hope this will shed some light on the problem...

Similar Messages

  • Using a jar file in my application... how?

    I have a JAR file which contains some classes I need to use in my application. I however, after looking in several books, cannot figure out how to use this JAR file within my application.
    Do I simply put it in the directory with my .java files, and use an import command? I'm confused.

    If the classes in the jar are part of a package then you can import them based on the package structure. The jar file will have to be part of your CLASSPATH variable.
    i.e.
    myUtils.jar
    resides in C:\"My Classes"
    CLASSPATH = .;"C:\My Classes";"C:\My Classes\myUtils.jar"
    within the jar I have the following class:
    \ameyer\Util\someUtil.class
    \ameyer\Util\anotherUtil.class
    To use these classes I could use the following import statement
    import ameyer.Util.*;
    This would import any class at that level in the jar.
    Note: the import part of the CLASSPATH is "C:\My Classes\myUtils.jar"
    hope this helps.

  • Error Message When Using a Class Files to Control Navigation

    This is my first attempt at using a class file in a flash project. My intent is to keep all of my navigation elements in class file called "Navigation".  However, I keep getting an error message when I publish.
    I am using a button to go back to the main screen and I gave that button the instance name of "bnt_home". I have also linked that button in the library to the class "Navigation".
    Here is the code:
    package
        import flash.display.SimpleButton;
        public class Navigation extends SimpleButton
            public function Navigation()
                bnt_home.addEventListener(MouseEvent.MOUSE_DOWN, goNavigation);
            private function goNavigation(event:MouseEvent):void
                gotoAndPlay(1,"Main");

    When I changed the code I got error (1046: Type was not found or was not a compile-time constant: MouseEvent).
    package
        import flash.display.SimpleButton;
        public class Navigation extends SimpleButton
            public function Navigation()
                this.addEventListener(MouseEvent.MOUSE_DOWN, goNavigation);
            private function goNavigation(event:MouseEvent):void
                root.gotoAndPlay(1,"Main");

  • Use of Lookup Files in BI Applications

    Hi,
    Can any one tell the use of lookup files in BI Applications. While doing the configurations (for all modules) for these lookup files we get the data from the ERP database tables using the query provided by oracle and populate the file and then map with some domain values.
    Why cant we directly populate the datawarehouse tables using the ERP tables instead of populating through the lookup files (which we any how populate with ERP tables). Also what is the use of domain values. Does these use in reporting puposes and anlyzing the data or business.
    Thank You,

    For e.g, when you map the GL group account numbers, the predefined group codes such as 'CASH', 'AR', 'AP' , 'TAX' etc are the domain values. In the repository, the metrics are defined based on these domain values.
    Say, you mapped your CASH accounts from 0011 through 0100, then OBIEE calculates the metrics related to CASH as summation (or some kind of calculation) on the accounts that have the group codes (domain values) as CASH.
    It should be possible to update the domain values directly from ERP database tables but the ETL expects the mapping to be in files. Also in some cases we cannot change the default domain values, all we can change is the mapping to these domain values or create new domain values. At one client, we had to create a new account group code called 'FIXED ASSET' as the default domain values were not sufficient but then we had to change the repository to include new metrics and change existing ones to incorporate this new group code.
    -Nilesh
    http://www.appsbi.com

  • Tomcat Web-server uses old .class files

    Hi Friends,
    My Tomcat webserver uses old .class files. The problem persists even if I delete old class files. The new ones are formed but then if i again recompile, the new-old ones are used :)
    Am I doing something wrong????
    Please suggest!!

    I have experienced this problem before as well. Tomcat seems to cache compiled class files for better speed. To get Tomcat to reload class files that I've recently recompiled here is what I do:
    1. Go into the Tomcat server administration area (http://localhost/admin)
    2. Choose the context that is using the classes that you want to reload (from Service / Host)
    3. Make sure reloadable is set to true
    3. Click save, and then commit changes
    Hope this helps, but if there is a better way to get Tomcat to use the most recent class files I would love to hear it!

  • How to use/call .class file in jdeveloper

    I have a .class file that is run as part of cron job on the UNIX server. It has three parameters - so the call goes something like this java exampleClass1 param1 param2 param3.
    I need to import it into my Jdeveloper project so it can be called from a web application. Please help.
    I tried importing the directory as a library(was I supposed to jar it first?) and updated classpath to use the directory with this class file too. But in my code...how do I call exampleClass1?

    If the exampleClass1 does have a public method which is called from the main method, when you run it from the command line
    should work like this
    // sample class
    public class ExampleClass1
        // C'tor
        public ExampleClass1 ()
        public void testmethodWith3Params(String aS1, String aS2, String aS3)
            // do the work here
        public static void main(String[] args)
            String p1;
            String p3;
            String p3;
            ExampleClass1 xyz = new ExampleClass1();
            // read the params into p1,p2 and p3
            // omited the code
           // call the worker method
           xyz.testmethodWith3Params(p1,p2,p3);
    // now instead to call the main method you call the workter methos from your web app like
    ExampleClass1 aaa = new ExampleClass1 ();
    aaa.testmethodWith3Params(param1, param2,param3);
    ...If you don't have a method (or don't know it) you can call it via the main method like
    String [] param= {p1,p2,p3};
    ExampleClass1.main(param);Timo

  • Reverse-Engineer Java Class Files ---- Launch Java Application From Icon

    hi,
    is there a way to prevent java class files from being interpreted back into java source files (jad.exe does exactly that) ?
    i have a batch file to compile my java application and another to run the application. the application is run by invoking the batch file from dos window.
    i'd like to be able to double-click on some icon to launch the application.
    how do i accomplish this?
    thank you.

    s there a way to prevent java class
    files from being interpreted back into
    java source files (jad.exe does exactly that) ?There are two ways to prevent that:
    1. Use an obfuscator. Look at this page for
    explanation of what is that, and then search google
    "java obfuscator" for products.
    http://www.devx.com/tips/Tip/13580
    2. Compile your application to native code (google
    for "excelsior jet" or "gcj"). Look at this page for
    more details:
    http://www.excelsior-usa.com/jetprotection.html
    i'd like to be able to double-click on some
    icon to launch the application.
    how do i accomplish this?Do you want to do that on your computer only, or you
    need a solution to make the clickable icon on
    computers of your end-users?
    Denis.thanks to all,
    i'll see suggest sites for more details on obfuscator.
    I'd like to have the application doulbe-clickable on end-users' computers.

  • Updating class file in deployed application in integrated Weblogic of Jdev

    Dear all,
    The Jdeveloper I'm using is version : 11.1.2.1.0
    When I deployed an application and then change the '.jspx' content and save, it will update the file in the deployed application in the integrated weblogic and everything works fine. (I can see the updated immediately without undeploy/deploy the application). When I updated a .java file, after compiling, it will shown the same message saying that the application on the integrated weblogic server is updated too, however, when I try clicking the page, it will show null pointer exception.
    Just hope to ask if manually undeploy/deploy the whole application is needed after updating a .java (class) file or it's just some configuration issue?
    Thanks a lot!
    Andrew

    Hi,
    I've tried to rebuild the whole working space but the exceptions are still exist. The error messages are pasted below for reference.
    So to get the udpated .java (class) to work, I need to 'manually' click on the 'run' command to the task flow file and a 'undeploy -> deploy' process will be done by the jdeveloper (need to wait for a few minutes).
    If no need to (undeploy->deploy), I think I can save many time a day. Anyway, Thanks for all repiles!
    Andrew
    Error Message:
    [05:52:06 PM] Updated /C:/Users/second52/AppData/Roaming/JDeveloper/system11.1.2.1.38.60.81/o.j2ee/drs/TRS_WEB/ViewControllerWebApp.war/WEB-INF/classes
    <ConfigureListener> <contextInitialized> Initializing Mojarra 2.0.5 (FCS b02) for context '/TRS'
    <Feb 22, 2012 5:52:40 PM HKT> <Error> <HTTP> <BEA-101020> <[ServletContext@17528203[app:TRS_WEB module:TRS path:/TRS spec-version:2.5]] Servlet failed with Exception
    java.lang.ClassCastException: oracle.adfinternal.view.faces.webapp.rich.RichWindowManagerFactory$WindowIdProviderAdapter cannot be cast to org.apache.myfaces.trinidad.event.WindowLifecycleListener
         at oracle.adfinternal.view.faces.webapp.rich.RichWindowManagerFactory$ApplicationWindowListeners.processWindowLifecylce(RichWindowManagerFactory.java:244)
         at oracle.adfinternal.view.faces.webapp.rich.RichWindowManager._fireWindowLifecycleEvent(RichWindowManager.java:496)
         at oracle.adfinternal.view.faces.webapp.rich.RichWindowManager._handleWindowOpened(RichWindowManager.java:539)
         at oracle.adfinternal.view.faces.webapp.rich.RichWindowManager.renderLoopbackPage(RichWindowManager.java:946)
         at oracle.adfinternal.view.faces.webapp.rich.RegistrationFilter.doFilter(RegistrationFilter.java:110)
         Truncated. see log file for complete stacktrace
    >
    <Feb 22, 2012 5:52:40 PM HKT> <Notice> <Diagnostics> <BEA-320068> <Watch 'UncheckedException' with severity 'Notice' on server 'DefaultServer' has triggered at Feb 22, 2012 5:52:40 PM HKT. Notification details:
    WatchRuleType: Log
    WatchRule: (SEVERITY = 'Error') AND ((MSGID = 'WL-101020') OR (MSGID = 'WL-101017') OR (MSGID = 'WL-000802') OR (MSGID = 'BEA-101020') OR (MSGID = 'BEA-101017') OR (MSGID = 'BEA-000802'))
    WatchData: DATE = Feb 22, 2012 5:52:40 PM HKT SERVER = DefaultServer MESSAGE = [ServletContext@17528203[app:TRS_WEB module:TRS path:/TRS spec-version:2.5]] Servlet failed with Exception
    java.lang.ClassCastException: oracle.adfinternal.view.faces.webapp.rich.RichWindowManagerFactory$WindowIdProviderAdapter cannot be cast to org.apache.myfaces.trinidad.event.WindowLifecycleListener
         at oracle.adfinternal.view.faces.webapp.rich.RichWindowManagerFactory$ApplicationWindowListeners.processWindowLifecylce(RichWindowManagerFactory.java:244)
         at oracle.adfinternal.view.faces.webapp.rich.RichWindowManager._fireWindowLifecycleEvent(RichWindowManager.java:496)
         at oracle.adfinternal.view.faces.webapp.rich.RichWindowManager._handleWindowOpened(RichWindowManager.java:539)
         at oracle.adfinternal.view.faces.webapp.rich.RichWindowManager.renderLoopbackPage(RichWindowManager.java:946)
         at oracle.adfinternal.view.faces.webapp.rich.RegistrationFilter.doFilter(RegistrationFilter.java:110)
         at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl$FilterListChain.doFilter(TrinidadFilterImpl.java:468)
         at oracle.adfinternal.view.faces.activedata.AdsFilter.doFilter(AdsFilter.java:60)
         at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl$FilterListChain.doFilter(TrinidadFilterImpl.java:468)
         at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl._doFilterImpl(TrinidadFilterImpl.java:293)
         at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl.doFilter(TrinidadFilterImpl.java:199)
         at org.apache.myfaces.trinidad.webapp.TrinidadFilter.doFilter(TrinidadFilter.java:92)
         at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
         at oracle.security.jps.ee.http.JpsAbsFilter$1.run(JpsAbsFilter.java:111)
         at java.security.AccessController.doPrivileged(Native Method)
         at oracle.security.jps.util.JpsSubject.doAsPrivileged(JpsSubject.java:313)
         at oracle.security.jps.ee.util.JpsPlatformUtil.runJaasMode(JpsPlatformUtil.java:413)
         at oracle.security.jps.ee.http.JpsAbsFilter.runJaasMode(JpsAbsFilter.java:94)
         at oracle.security.jps.ee.http.JpsAbsFilter.doFilter(JpsAbsFilter.java:161)
         at oracle.security.jps.ee.http.JpsFilter.doFilter(JpsFilter.java:71)
         at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
         at oracle.dms.servlet.DMSServletFilter.doFilter(DMSServletFilter.java:136)
         at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
         at weblogic.servlet.internal.RequestEventsFilter.doFilter(RequestEventsFilter.java:27)
         at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
         at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.wrapRun(WebAppServletContext.java:3715)
         at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3681)
         at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
         at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:120)
         at weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:2277)
         at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:2183)
         at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1454)
         at weblogic.work.ExecuteThread.execute(ExecuteThread.java:209)
         at weblogic.work.ExecuteThread.run(ExecuteThread.java:178)
    SUBSYSTEM = HTTP USERID = <WLS Kernel> SEVERITY = Error THREAD = [ACTIVE] ExecuteThread: '4' for queue: 'weblogic.kernel.Default (self-tuning)' MSGID = BEA-101020 MACHINE = trsenh01 TXID = CONTEXTID = ca100e6c7f7fafe1:-4db71864:135a424c0e1:-8000-00000000000000ce TIMESTAMP = 1329904360140
    WatchAlarmType: AutomaticReset
    WatchAlarmResetPeriod: 30000
    >

  • How to decomplie a java class file when java application is running/launch?

    I have a simple java application with some components being displayed, now i need to get the components instance names that are been created in that java application. How do i do that?
    Eg: Button b1 = new button();
    now how to write a java application to decompile this class file & return me the button instance ie "b1".

    I think you wanna do two different things:
    1. find out which objects were created at runtime.
    2. decompile class file.
    I'm no so sure why.
    have you tried insrospecting the class using reflection ?
    Here is a code snippet that prints class field names.
    try{
      Class c = Class.forName("MyClass");
      java.lang.reflect.Field[]  f=    c.getFields();
      for (int i = 0;i<f.length; i++)
           System.out.println(f.getName());
    catch(Exception e){ }
    Regards
    Joseph.

  • Problem using misc jar-Files in Composite Application

    Hi there,
    I want to use different jar-Files in my Composite Application on SAP Netweaver 7.3.
    I have created an external Lib DC where I have inserted the libs. After that I created an enterprise EAR and added the dependency to the PP of the external lib DC.
    After that I added the a dependency to my CAF-EAR. But I cannot access the mehtods and functions from my jar files.
    What's wrong there?
    Another question: Is it possible to add the jar-files directly to my CAF-EAR without creating the external library DC and adding a dependency?
    Any help would be greatly appreciated
    Thanks

    Hi, I've downloaded Jacob and got it running on my installation by doing the following:
    1. Download http://danadler.com/jacob/jacobBin_17.zip.
    2. Extract to Jdeveloper10g/jdev/lib/ext/Jacob
    3. Copy jacob.dll to c:/windows/system32
    4. Add JDeveloper10g/jdev/lib/ext/Jacob/jacob.jar to JDev user libraries, calling it 'Jacob'
    5. Add the 'Jacob' library to the project.
    6. Create a word document at c:/java/jacob/file_in.doc
    7. Create a new class with the following code:
    package view;
    import com.jacob.*;
    import com.jacob.activeX.ActiveXComponent;
    import com.jacob.com.Dispatch;
    import com.jacob.com.Variant;
    public class TestJacob
    public TestJacob()
    * @param args
    public static void main(String[] args)
    TestJacob testJacob = new TestJacob();
    testJacob.runTest();
    public void runTest()
    boolean tVisible = true;
    String sDir = "c:\\java\\jacob\\";
    String sInputDoc = sDir + "file_in.doc";
    ActiveXComponent oWord = new ActiveXComponent("Word.Application");
    oWord.setProperty("Visible",new Variant(tVisible));
    Object oDocuments = oWord.getProperty("Documents").toDispatch();
    Object oDocument = Dispatch.call(oDocuments, "Open", sInputDoc).toDispatch();
    }

  • How can I make server use single class loader for several applications

    I have several web/ejb applications. These applications use some common libraries and should share instances of classes from those libraries.
    But applications are being deployed independently thus packaging all them to EAR is not acceptable.
    I suppose the problem is that each application uses separate class loader.
    How can I make AS use single class loader for a set of applications?
    Different applications depend on different libraries so I need a way that will not share library for all applications on the domain but only for some exact applications.
    When I placed common jar to *%domain%/lib* - all works. But that jar is shared between all applications on the domain.
    When I tried to place common jar to *%domain%/lib/applibs* and specified --libraries* attribute on deploying I got exception
    java.lang.ClassCastException: a.FirstDao cannot be cast to a.FirstDaoHere http://download.oracle.com/docs/cd/E19879-01/820-4336/6nfqd2b1t/index.html I read:
    If multiple applications or modules refer to the same libraries, classes in those libraries are automatically shared.
    This can reduce the memory footprint and allow sharing of static information.Does it mean that classes should be able to be casted ?

    You didn't specify which version of the application server you are using, but the config is similar as long as you know what to look for. Basically, you need to change the classloader delegation. Here's how it is done in 8.2
    http://download.oracle.com/docs/cd/E19830-01/819-4721/beagb/index.html

  • Can It Be Done? - Using Java Class Files from a DB

    Hello,
    I am interested in storing a binary java class file in my oracle DB. Then I want to get it out at runtime and execute methods on it. I am planning on casting the object to an interface and executing the methods within. Please let me know if this is possible and where to look for more info, and a code example would be awesome.
    Joe
    [email protected]

    I think you are going to need to serialize the objects and the classes. (Don't get stuck on semantics here, I don't mean use Java Serialization to write the Class instance, I am referring to writing the .class file to a field in the database.) Obviously the instances are what you are interested in (since you mentioned casting them to interfaces and invoking methods on them), but the class definitions will need to either be available already, or stored elsewhere in the database.

  • Different languages used while uploading file from java Application

    Hi everybody,
    i have a problem with multiple languages , let me clear you the question, i were developing a java application using spring ,hibernate frame works, so i got a problem while uploading a file with chinees language or other
    it was saving with different format other than chiness in the database, can any one help me out ... i need the exact language when i upload the files,and when i get the data from DataBase which is in chinees language is '걨' going to be like as '???'
    thank you very much

    Santhosh_25 wrote:
    using utf-8 characterSet, but its not showing properly
    thank youOkay.. the problem with your browser settings.. (not sure)..
    In firefox try to set character encoding...
    go to View--->Character Encoding--->Unicode (UTF-8)..
    In IE
    go to View--->Encoding-->More-->Unicode (UTF-8)
    set this and try.

  • Using .cfr report files in an application

    We are developing an application that sits behind a login. In this application we have several .cfr pages. When we try to access one of the reports the web browser returns a blank page. If we remove the application.cfc file from the root directory the pabe works fine. I am assuming the reason for this is the .cfr extension is not being accepted as an application page. Dose anyone know how to correct this? Our servers are windows based and coldfusion is running under iis.
    Thanks
    Hal Brown

    Nope.  If you look at the Help for the "Run VI" method, you find the following information for "Auto Dispose Ref":
    "If TRUE, the target VI detaches the reference from the main VI.  When the target VI finishes executing, LabVIEW automatically disposes of the reference, along with the parallel data space.  If FALSE, the main VI retains control of the target VI."
    So by setting "Auto dispose" to T, you pass control of the reference to the subVI itself, and LabVIEW will dispose of the reference when the subVI finishes running.
    I will second Jeff and urge you to get rid of the global variable!  I haven't used a global variable in something like 14 years.  I haven't needed to.  Myself, I love a good notifier and would urge you to use a notifier instead of a queue if you're going to be spawning VIs.  Why?  Because the first instance of your spawned VI to receive the "stop" message from the queue will remove that message from the queue, thus preventing the other instances from receiving the message.  So you'll have to send the message repeatedly and hope that everyone eventually receives it.  If you use a notifier, anything that contains a "Wait on Notification" with that notifier reference will receive the message.  I think you want multiple listeners here, right?
    Ok, this afternoon I'll try to write some dummy code with a statically called VI in it, compile it into an exe, and see if I can duplicate your problem...
    One question, were you just using the static VI reference by itself to call your VI, or were you using it the same way I showed in my earlier post, with "Open VI reference"?  I'm just trying to look for differences between what I've done in the past which has worked, and what you're doing now which isn't working...
    Jeff, what say you?

  • Using normal class file in the servlet

    Hello Friends;
    Now my problem is ;
    I generated a java file ;
    import drasys.or.mp.*;
    import drasys.or.mp.lp.*;
    public class optimize
        public static void main(String[] args)
        try
            int r=1;
            int s=0;
    .This file works perfect. It calls an API and there is no problem. But when I take this code into my servlet, then problem starts. First it says;
    "java.lang.NoClassDefFoundError: drasys/or/mp/ScaleException"
    but I know it is there. And I mounted the jar file.
    Do you think there is a problem with my codes, because it works when it is outside of the servlet.
    My servlet code is as follows;
    import javax.servlet.*;
    import javax.servlet.http.*;
    import java.io.*;
    import java.sql.*;
    import java.util.*;
    import java.net.*;
    import drasys.or.mp.*;
    import drasys.or.mp.lp.*;
    protected void processRequest(HttpServletRequest request, HttpServletResponse response)
        throws ServletException, IOException {
            response.setContentType("text/html");
            PrintWriter out = response.getWriter();
             try
            int r=1;
            int s=0;
            int n = 3;
            int t,w,u,v,f;
            f = 1;
            int z=0;
            int y = 1;
            int l = 1;
            double [][][][] C = new double [1][1][n-1][n];
            double [][][][] D = new double [1][1][n-1][n];
            C[0][0][0][1]=2.5-0.92*r;
            C[0][0][0][2]=1.43-0.37*r;
            C[0][0][1][2]=1.14-0.48*r;
            D[0][0][0][1]=0.65*r+0.94;
            D[0][0][0][2]=0.31*r+0.75;
            D[0][0][1][2]=0.27*r+0.40;
         SizableProblemI prob = new Problem(n*(n-1)+1,n);
            prob.getMetadata().put("lp.isMaximize", "true");
            prob.newVariable("Lambda").setObjectiveCoefficient(1.0);
            for (t=0;t<=(n-1);t++)
                prob.newVariable("W"+t).setObjectiveCoefficient(0);
            final byte LTE = Constraint.LESS;
            final byte EQU = Constraint.EQUAL;
            for (v = 1;v <= n*(n-1);v++)
                   prob.newConstraint("constr"+v).setType(LTE).setRightHandSide(y);
                prob.newConstraint("constr"+(n*(n-1)+1)).setType(EQU).setRightHandSide(1);
                // here, we are creating coefficients for lambda.
            for (u = 1; u <= n*(n-1); u++)
                    prob.setCoefficientAt("constr"+u,"Lambda",y);
    // here, we are creating coefficients for W�s.
            for(t = 0 ; t <= (n-2); t++)
                for (w = 1; w <= (n-1); w++)
                     if (t<w)
                         prob.setCoefficientAt("constr"+l, "W"+t, 1);
                         prob.setCoefficientAt("constr"+l,"W"+w, (-C[s][z][t][w]));
                         l = l + 1;
                         prob.setCoefficientAt("constr"+l, "W"+t, -1.0);
                         prob.setCoefficientAt("constr"+l, "W"+w, D[s][z][t][w]);
                         l = l + 1;
    /* here , we are creating coefficients for the last formula which is w1+w2+w3+....Wn = 1 */
                for (f=0; f <= (n-1); f++)
                prob.setCoefficientAt("constr"+(n*(n-1)+1), "W"+f, 1);
    /* API finds the solution below.*/
         LinearProgrammingI lp = new DenseSimplex(prob);
            double ans = lp.solve();
            System.out.println("Solution"+r+"="+ans);
            System.out.println(lp.getSolution());
            catch (drasys.or.mp.DuplicateException first)
             first.getMessage();
            catch (drasys.or.mp.NotFoundException second)
            catch (drasys.or.mp.InvalidException third)
            catch (drasys.or.mp.NoSolutionException fourth)
            catch (drasys.or.mp.UnboundedException fifth)
            catch (drasys.or.mp.InfeasibleException sixth)
            catch (drasys.or.mp.ConvergenceException seventh)
            catch (drasys.or.mp.ScaleException eigth)
               eigth.toString();
       

    Thanks a lot for the reply.
    Forgive me, I have no object oriented background,
    even programming. I am just in the learning phase.This is a pretty advanced problem to tackle for your first programming task.
    That's why it doesn't follow OO concepts. This part
    will be connected to user input part, that I've
    completed .Hmmm.
    Successful programming depends on one idea: "divide and conquer". You take a big problem and solve it by dividing it into smaller chunks that you CAN handle. You get the solution you want by bringing the smaller chunks together.
    In your case I'd recommend that you get the optimization code into a single object that you can test off-line, without Tomcat. It looks like you started to do that with your optimize class, but the mistake you made is to put so much code into the main() method. You can only call that on the command line. Better to encapsulate the rest of it into small methods that will let you instantiate an instance of optimize and call its methods. Once you have that working you can wrap it in a servlet if you want to use it in a Web app.
    Separate how your optimizer gets its data from how it processes it. On a desktop app, it might be convenient to read input from a file on disk. A Web app might be better served by an XML stream.
    Why I said "I know it is there" because it doesn't
    give any other error message than that one, if it
    couldn't see the jar file, wouldn't it give me lots
    of error messages? Don't assume anything. It only needs one error, which is the one you get when it can't find a class. How many more do you need? The class loader couldn't find that class, so it printed the message and stopped.
    "I mounted" the jar file means I'm using Netbeans, I
    mounted it to that environment as suggested by
    Netbeans, If you don't know Java or programming well, I'm guessing that you also don't know NetBeans. I'd recommend that you figure out how to make all this work without NetBeans before you add another complication to your life.
    If you don't use NetBeans, all you have to do is add the JAR to your CLASSPATH using the -classpath option on javac.exe when you compile and java.exe when you execute.
    Tomcat assumes that all the JAR files in your Web app's WEB-INF/lib are in the CLASSPATH. If you put it in there, Tomcat will find it.
    you're right, I'm using Tomcat 5.0,
    everything is working fine, user input servlets,
    mysql connection etc. Only this part is causing the
    problem now.If you've already got a Web app deployed and connected to MySQL, you're not doing too badly. Kudos to you - that's not too bad for someone who claims to be a programming novice.
    I'll put that jar file into lib folder as you suggested thanks.I think that might be all you'll need. Try it and see.
    Actually I saw an example it was using "throws
    exception" , I couldn't figure out where to put it,
    and I decided to get rid of the compiling errors just
    putting bunch of catch statements.If you're saying that your code is throwing a lot of checked exceptions, and you added these extra catch blocks to get rid of them, another way to do it would be to simply have a single catch block, like this:
    try
        // your code in here
    catch (Exception e)
        e.printStackTrace();
    }Polymorphism says that this catch block will handle all checked exceptions.
    >
    Looks like I don't know anything but I'm trying to
    handle a big thing :))).Indeed you are. Anyone who can write a Web app and connect it to a relational database on their first try is hardly helpless. We're all ignorant, just about different things. Keep digging - you'll make this work.
    But thank you soooo much for your detailed answer, and happy new year.
    Shamil.And the same to you, Shamil. Good luck, and let me know how you make out.
    %

Maybe you are looking for

  • How do I add PDFs to a custom bokshelf?

    I have created several bookshelves and want to add specific items to specified bookshelves. However, it seems that items are added to the Library and then have to be dragged to the specific bookshelf. This means I have to find a single item among sev

  • Is an index used in ORDER BY

    Hi all, I was wondering if an index is used in ORDER BY clause? Thanks

  • ITunes 9.0.1 (9) update fixed my iPhone 3g sync problem

    After upgrading to iTunes 9, my iPhone would no longer sync with my iMac G5 (Tiger). I spent 35 minutes with Apple on the phone (no solution), then talked to a Genius at the store for 20 minutes. They made another appointment for me to bring in my iM

  • Limiting postings to specified accounts to interfaces

    Just wanted to get some thoughts as to the best way to allow certain accounts to only be posted to by interfaces but not by actual manual journal entries in ECC?  I'm sure there are several ways to achieve this but I just wanted to get as many ideas

  • Resource bundle question, where does it fit into package structure?

    I have a resource bundle but am getting an exception that says my resource bundle is not found (base type) of my OS local. I am not sure why. Here is my log... 11 Apr 2009 10:40:09 AM suncertify.util.ErrorHandler handle SEVERE: Can't find bundle for