# How to compile java source on FreeBSD



## urello (Jul 18, 2013)

I want to install a Java app (airport2-config) on FreeBSD, but I haven't had any experience with Java before. I've downloaded the application sources and installed OpenJDK7 from /usr/ports/java. What is the next step?


----------



## SirDice (Jul 18, 2013)

You usually just run the java application with `java -jar <application.jar>`


----------



## Amzo (Jul 18, 2013)

Also keep in mind, some Java applications test which OS they are being run on, and sometimes only check for Linux, OSX or Windows. If this is the case you can add 
	
	



```
-Dos.Name=Linux
```
 to the command `java -Dos.Name=Linux -jar <application>`.


----------



## urello (Jul 18, 2013)

SirDice said:
			
		

> You usually just run the java application with `java -jar <application.jar>`


I don't have any .jar files there, only .java:

```
[termit@taz-x10 ~/airport2config-2.0.1]$ pwd
/home/termit/airport2config-2.0.1
[termit@taz-x10 ~/airport2config-2.0.1]$ ls
AUTHORS                                         AirportBaseStationConfiguratorMicro.java
AboutDialog.java                                AirportBaseStationMultiConfigurator.java
AirportBaseStation128BitConfigurator.java       COPYING
AirportBaseStationCLI.java                      airport
AirportBaseStationConfigurator.java
[termit@taz-x10 ~/airport2config-2.0.1]$ ls airport/
Airport2InfoElement.java                        AirportInfoRecord.java
Airport2InfoElementVector.java                  AirportInfoRecordDisplay.java
Airport2ProtocolMessage.java                    AirportInfoScaledValueField.java
AirportAccessControlTable.java                  AirportInfoTabbedPane.java
AirportAdvancedPanel.java                       AirportInfoTextField.java
AirportBridgingPanel.java                       AirportLoginInfoDialog.java
AirportDHCPPanel.java                           AirportLoginInfoPanel.java
AirportDHCPRangePanel.java                      AirportLoginStringTable.java
AirportDiscoverer.java                          AirportMainPanel.java
AirportDiscoveryInfo.java                       AirportModemConfigPanel.java
AirportDistanceRatePanel.java                   AirportNetworkPanel.java
AirportEncryptionPanel.java                     AirportPPPoEConfigPanel.java
AirportEthernetConfigPanel.java                 AirportPPPoELoginInfoDialog.java
AirportIPConfigPanel.java                       AirportPhoneNumberPanel.java
AirportInfo.java                                AirportPortMappingPanel.java
AirportInfoCheckBox.java                        AirportPortMappingTable.java
AirportInfoComboBox.java                        AirportSNMPAccessControlTable.java
AirportInfoComponent.java                       AirportSNMPPanel.java
AirportInfoLabelledScaledValueField.java        AirportUsernamePPPoEClientIDPanel.java
AirportInfoLabelledTextField.java               AirportUsernamePanel.java
AirportInfoListDisplay.java                     AirportWirelessPanel.java
AirportInfoPanel.java                           ValueFormatException.java
AirportInfoRadioButton.java                     package.html
```


----------



## ShelLuser (Jul 18, 2013)

urello said:
			
		

> I want to install a Java app (airport2-config) on FreeBSD, but I haven't had any experience with Java before.


Well, Java is pretty cool and that's usually the most important thing to know 

The first important thing to know is that airport2-config is basically nothing more but a wrapper script around Airport2BaseStationConfig.jar. From what I can tell this is part of a bigger software program called Apple Airport.

However, the current ports collection already seems to provide net-mgmt/airport, so I can't help wonder if it won't be easier on you to use this port instead?

As to compiling the source you already have, doesn't the site where you got the sources from provide any documentation? Because this isn't easily answered, also because there isn't a real standard answer to compiling Java applications.

Many developers use ant, comparable to make but instead of a Makefile it uses an ant file usually called build.xml. If such a file is present then all it might take is using the `ant` command.

But others rely on relationships between the different sourcefiles. In that case it can become even harder to compile this because you might need to take care of using a specific directory structure (depending on the way they set things up, I think I'd better not bother you with elaborating on packages and such ).

So you really want to check the main documentation. Or grab the port.


----------



## SirDice (Jul 18, 2013)

One of the things that's supposed to make Java great is the fact you can run it on anything. There really shouldn't be a need to compile the Java source code. Just run the Java "binary" with the command I showed earlier.


----------



## urello (Jul 18, 2013)

As advised, I installed from port. But when I run binaries I get no output. No errors, warnings etc. Just nothing

```
[root@taz-x10 ~]# cd /usr/ports/net-mgmt/airport/
[root@taz-x10 /usr/ports/net-mgmt/airport]# make config
===> No options to configure
[root@taz-x10 /usr/ports/net-mgmt/airport]# make install clean
...TRUNCATED...
[root@taz-x10 /usr/ports/net-mgmt/airport]# airport
airport   airport2  
[root@taz-x10 /usr/ports/net-mgmt/airport]# airport
[root@taz-x10 /usr/ports/net-mgmt/airport]# airport2
[root@taz-x10 /usr/ports/net-mgmt/airport]# java -jar /usr/local/share/java/airport/
Airport2BaseStationConfig.jar  AirportModemUtility.jar        LinkMonitor.jar                
AirportBaseStationConfig.jar   HostMonitor.jar                
[root@taz-x10 /usr/ports/net-mgmt/airport]# java -jar /usr/local/share/java/airport/LinkMonitor.jar
[root@taz-x10 /usr/ports/net-mgmt/airport]# java -jar /usr/local/share/java/airport/Airport2BaseStationConfig.jar
[root@taz-x10 /usr/ports/net-mgmt/airport]#
```


----------

