• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

How do you compile java program?

 
Ranch Hand
Posts: 62
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
1. There is a project
2. Project has build.xml
3. I exucte "ant" command in the folder
4. I get this: http://pastebin.com/m7uGuA87
5. I pasted the "lib" folder (inlcuding the jars) into like 10 different places. I still get 100 errors.

How do you compile a java program?
 
Bartender
Posts: 1558
5
Eclipse IDE Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The first error says : /home/min/Downloads/PBapi1.4.3/api-java/core/src/com/photobucket/api/core/PhotobucketAPI.java:38: error: package org.apache.http.client.methods does not exist

This seems to be classpath issue.

Please make sure that all relevant jars are in classpath.
 
Justin Thomas
Ranch Hand
Posts: 62
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I already told you I copied the folder "lib" containing all the jars in *counts carefully* 8 different places. I don't know where ELSE I have to copy it for the compiler to see them....
 
author
Posts: 23951
142
jQuery Eclipse IDE Firefox Browser VI Editor C++ Chrome Java Linux Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Justin Thomas wrote:I already told you I copied the folder "lib" containing all the jars in *counts carefully* 8 different places. I don't know where ELSE I have to copy it for the compiler to see them....



It doesn't work that way, you can't copy jar files into a classpath (which is actually not a good idea regardless). A classpath specified both directories and jar files -- the directories (like the jar files) are searched only for class files; putting a jar file into these directories doesn't add them to the search. You need to add the jar file to the classoath (meaning the classpath variable needs to mention the jar file).

Henry
 
Java Cowboy
Posts: 16084
88
Android Scala IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You'd have to look into the Ant build file (build.xml) to find out where it expects to find the necessary library JAR files.
 
Justin Thomas
Ranch Hand
Posts: 62
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Henry Wong wrote:
It doesn't work that way, you can't copy jar files into a classpath (which is actually not a good idea regardless). A classpath specified both directories and jar files -- the directories (like the jar files) are searched only for class files; putting a jar file into these directories doesn't add them to the search. You need to add the jar file to the classoath (meaning the classpath variable needs to mention the jar file).

Henry



I didn't understand your explanation.

As far as build.xml goes -> http://pastebin.com/kDQTcbHV
This is the first time I opened build.xml file in my life.... I noticed:
<property name="lib.dir" value="lib"/>

And in the main folder there already IS a lib dir that contains the jars.... so I am even more confused right now....
 
Henry Wong
author
Posts: 23951
142
jQuery Eclipse IDE Firefox Browser VI Editor C++ Chrome Java Linux Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Jesper de Jong wrote:You'd have to look into the Ant build file (build.xml) to find out where it expects to find the necessary library JAR files.



To elaborate, this would also depend on the Ant file. I have seen some that parses a directory for jar files and create a classpath accordingly. More commonly, is a variable which lists the jar files to be included. And unfortunately, since an Ant file is a script, I have also seen tons of bad stuff too.... debugging badly written Ant files are no fun...

Henry
 
Henry Wong
author
Posts: 23951
142
jQuery Eclipse IDE Firefox Browser VI Editor C++ Chrome Java Linux Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Justin Thomas wrote:
I didn't understand your explanation.

As far as build.xml goes -> http://pastebin.com/kDQTcbHV
This is the first time I opened build.xml file in my life.... I noticed:
<property name="lib.dir" value="lib"/>

And in the main folder there already IS a lib dir that contains the jars.... so I am even more confused right now....



All that line does is set a variable named "lib.dir" to a value of "lib". You need to figure out what your Ant script does with it -- and fix accordingly.

Henry
 
Justin Thomas
Ranch Hand
Posts: 62
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Henry Wong wrote:You need to figure out what your Ant script does with it -- and fix accordingly.

Henry



How?
 
Henry Wong
author
Posts: 23951
142
jQuery Eclipse IDE Firefox Browser VI Editor C++ Chrome Java Linux Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Justin Thomas wrote:

Henry Wong wrote:You need to figure out what your Ant script does with it -- and fix accordingly.

Henry



How?



Sorry. I don't work on Ant scrpts enough to have any magic bullet tricks. The last few times that I did it, I merely brute forced it -- running ant in debug mode and adding lots of echos to the screen,

I am sure that there are ant script debuggers out there -- and someone else can chime in.

Henry

 
Marshal
Posts: 79151
377
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
This appears to be an Ant-related topic, rather than “beginning Java™”, so I shall move it to our Ant forum.
 
Justin Thomas
Ranch Hand
Posts: 62
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Henry Wong wrote: The last few times that I did it, I merely brute forced it -- running ant in debug mode and adding lots of echos to the screen,

I am sure that there are ant script debuggers out there -- and someone else can chime in.

Henry



I refuse to learn yet another absolutely totally completely utterly useless technology that I will use and see only once in my entire life. Isn't there any smart way to fix it?
Is hardcore brute-forcing the only way?
 
Justin Thomas
Ranch Hand
Posts: 62
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I guess this is the key:



It finally compiled. It even ran the tests. If it works - I will check in a moment....
 
Justin Thomas
Ranch Hand
Posts: 62
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Ok, despire the fact that the library itself has some issues, the ant compilation process works, so this topic is done.
 
reply
    Bookmark Topic Watch Topic
  • New Topic