0

I downloaded an API from Uniprot, which is a protein database, to play around with their code. This is my first time working with an API. The API contains a folder of source files (which includes example code for developers), a folder for classes, a library of JAR files, and an executable command file to run the example code (in cmd, I must execute: runExample.cmd InsertExampleCodeHere )

How do you edit this API? I tried making my own Java project, linked it to the JARS I downloaded, and also transferred over the executable cmd program to my Java project folder. At first, I copied over some of the example code, and added some print statements. When I saved my changes and executed the cmd file, my main class cannot be found. If I tried compiling my java project, I get a bunch of errors - and these errors apply to the example codes Uniprot provides (and while linked to the library of JARs). Is there a particular call (or special command) I must make when compiling my projects?

Thanks in advance!

batlike
  • 668
  • 1
  • 7
  • 19

1 Answers1

1

Hmm, not sure myself as the only real API I was using was a JSON one so I could easily parse it. But, assuming you have a folder that contains of all that, I would imagine you could try to just copy it over to your project's folder and then just add it to build path in a similar vein to how you would add jars. At least that's what I can think of.

Also, you could try this which is a solution I found from the Stackoverflow question titled "How do I important the javax.servlet AOI in my Eclipse project?"

Quick Fix- This worked in Eclipse - Right Click on project -> Properties -> Java Build Path (Tab) -> Add External JARs -> locate the servlet api jar implementation (if Tomcat - its named servlet-api.jar) -> click OK. That's it !!

SomeStudent
  • 2,856
  • 1
  • 22
  • 36
  • Hey Ageoffan, thanks for your response! I tried it but I can't seem to execute my code. The .cmd file can't seem to find my main class, even after I've built the path to external JARs. – batlike Jul 15 '15 at 20:22
  • Hmmm....I know that on times when I say convert my project in Eclipse into a Maven type it always outputs that there is some error. Deleting the project from Eclipse (not from disk though), and reimporting it usually fixes it. See if the same solution can apply to your case. – SomeStudent Jul 15 '15 at 20:26
  • See if this answer can help you as well, http://stackoverflow.com/questions/12096016/java-cant-find-main-class – SomeStudent Jul 15 '15 at 20:30
  • Thanks for the support! For whatever reason, the example code just decided to compile. I don't know what I did differently, but after linking my JAR files on the umpteenth try it worked. – batlike Jul 16 '15 at 13:36
  • Hmmm, code can be weird like that times, it may also dependent on the IDE you are using. Talking to some of the devs here at work they all seem to dislike Eclipse due to its instability at times. If the questions helped at all btw, make sure to try upvote it or w.e so others may know what to reference. – SomeStudent Jul 16 '15 at 13:39
  • Try perhaps using IntelliJ or NetBeans (once you get the hang of em), and see if the same issue occurs with adding jars to buildpath. – SomeStudent Jul 16 '15 at 13:42
  • Sure thing. I would love to upvote your answer, but currently don't have enough reputation. In time, I will do so! – batlike Jul 16 '15 at 21:27