Java is a wonderful language and I was addicted to it because of ease of coding and debugging. I used CPLEX library to solve the Security Constrained Unit Commitment problem.

I was trying to read a file in java. However my code has a problem and I received errors. It was because I used a relative path to access file. However the following link helped me to resolve the problem.

 

http://bugs.java.com/bugdatabase/view_bug.do;:YfiG?bug_id=4483097

 

The part that helped me was:

EVALUATION

Not a bug.  If you need to resolve a filename against the value of
the "user.dir" system property then you must use getAbsolutePath (or
getAbsoluteFile, or getCanonicalPath, or getCanonicalFile).  Simpler
operations such as exists() always resolve against the directory in
which the Java virtual machine was originally invoked (and no, there
is no way to change that).

-- mr@eng 2001/7/23

As an industrial engineer I love Excel because it has made analysis easier for me. My struggle to work with excel workbooks started when I was using C#, however I wanted to use it like I was using VBA which was not the best way.

With java also I tried to read from and write into excel worksheets using Apache poi.

http://howtodoinjava.com/apache-commons/readingwriting-excel-files-in-java-poi-tutorial/

But working with these basic classes is frustrating if you just want to read and write some tables and vectors. That's where JETT or jXLS can help you.

A comparison between these two can be found in:

http://jett.sourceforge.net/jxls_comp.html

 It has a lot of dependencies whose link can be found on the website. Also most of the dependencies can be found in Apache poi bundle.

 

JETT requires the following libraries:

 

  • Apache POI 3.14
    • poi-3.14-20160307.jar
    • poi-ooxml-3.14-20160307.jar
    • poi-ooxml-schemas-3.14-20160307.jar
    • Apache POI, in turn, depends on the following library: XML Beans 2.6.0.
  • XML Beans 2.6.0
    • xmlbeans-2.6.0.jar
  • Apache Commons JEXL 2.1.1
    • commons-jexl-2.1.1.jar
    • Apache Commons JEXL 2.1.1 in turn depends on Commons Logging 1.1.1.
  • Apache Commons Logging 1.2
    • commons-logging-1.2.jar
  • SourceForge's jAgg 0.9.0
    • jagg-core-0.9.0.jar
  • JUnit 4.8.2 (for testing only)
    • junit-4.8.2.jar
  • HSQLDB 1.8.0.10 (for testing only)
    • hsqldb-1.8.0.10.jar

 

 

 

I used to use C++, however after I learned a little Java I switched to it because I love the code generation and the warnings it generates.

 

Pass by value or by reference:

http://stackoverflow.com/questions/7893492/is-java-really-passing-objects-by-value

 

 

 Running Java program from command shell sometimes is not easy. Gradle helps you to do that. I went through these steps to get to this result:

 

Running Java program from command shell

Source: javaindos.

Let's say your file is in C:\mywork\

Run Command Prompt

C:> cd \mywork

This makes C:\mywork the current directory.

C:\mywork> dir

This displays the directory contents. You should see filenamehere.java among the files.

C:\mywork> set path=%path%;C:\Program Files\Java\jdk1.5.0_09\bin

This tells the system where to find JDK programs.

C:\mywork> javac filenamehere.java

This runs javac.exe, the compiler. You should see nothing but the next system prompt...

C:\mywork> dir

javac has created the filenamehere.class file. You should see filenamehere.java and filenamehere.class among the files.

C:\mywork> java filenamehere

This runs the Java interpreter. You should then see your program output.

 

If the system cannot find javac, check the set path command. If javac runs but you get errors, check your Java text. If the program compiles but you get an exception, check the spelling and capitalization in the file name and the class name and the java HelloWorld command. Java is case-sensitive!