Solaris 11 javac: command not found


root@bakuabsutdb:~# cd /tmp/
root@bakuabsutdb:/tmp# ls
Baku Baku.solaris hmptemp hsperfdata_root
root@bakuabsutdb:/tmp# 
root@bakuabsutdb:/tmp# 
root@bakuabsutdb:/tmp# 
root@bakuabsutdb:/tmp# 
root@bakuabsutdb:/tmp# 
root@bakuabsutdb:/tmp# ls
Baku Baku.solaris hmptemp hsperfdata_root Java_Timezone
root@bakuabsutdb:/tmp# 
root@bakuabsutdb:/tmp# 
root@bakuabsutdb:/tmp# cd Java_Timezone/
root@bakuabsutdb:/tmp/Java_Timezone# 
root@bakuabsutdb:/tmp/Java_Timezone# ls
azerbaycan.zip once sonra TimeZoneTest.class tzdata2016c.tar.gz tzupdater.jar verify.bat
deneme1 once_anar1 sonra_anar TimeZoneTest.java tzdata2016c.tar.gz.sha512 tzupdater.jar_backup verify.sh
java once_yeni sonra_anar1 tzdata2016b.tar.gz tzupdater-2_0_3-2015b.zip update.bat
New_Java_Timezone once_yeni2 sonra_yeni tzdata2016b.tar.gz.sha512 tzupdater-2.0.3-2015b update.sh
root@bakuabsutdb:/tmp/Java_Timezone# 
root@bakuabsutdb:/tmp/Java_Timezone# 
root@bakuabsutdb:/tmp/Java_Timezone# 
root@bakuabsutdb:/tmp/Java_Timezone# ls -ld /usr/java
lrwxrwxrwx 1 root root 15 May 27 18:12 /usr/java -> jdk/jdk1.8.0_60

root@bakuabsutdb:/tmp/Java_Timezone# java TimeZoneTestjavac 
Error: Could not find or load main class TimeZoneTestjavac
root@bakuabsutdb:/tmp/Java_Timezone# javac TimeZoneTest
-bash: javac: command not found


Solution:

root@bakuabsutdb:/tmp/Java_Timezone# sudo pkg install --accept jdk-8
 Packages to install: 2
 Create boot environment: No
Create backup boot environment: No

DOWNLOAD PKGS FILES XFER (MB) SPEED
Completed 2/2 625/625 46.3/46.3 0B/s

PHASE ITEMS
Installing new actions 736/736
Updating package state database Done 
Updating package cache 0/0 
Updating image state Done 
Creating fast lookup database Done 
Updating package cache 1/1

Result:

root@bakuabsutdb:/tmp/Java_Timezone# javac TimeZoneTest
error: Class names, 'TimeZoneTest', are only accepted if annotation processing is explicitly requested
1 error
root@bakuabsutdb:/tmp/Java_Timezone# javac -cp . TimeZoneTest.java
Note: TimeZoneTest.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
root@bakuabsutdb:/tmp/Java_Timezone# javac -Xlint:deprecation -cp . TimeZoneTest.java
TimeZoneTest.java:10: warning: [deprecation] Date(int,int,int) in Date has been deprecated
 long start = new Date(2016-1900, 0, 1).getTime();
 ^
TimeZoneTest.java:14: warning: [deprecation] toLocaleString() in Date has been deprecated
 System.out.println("is dt " +d.toLocaleString() + " ? : "+ tz.inDaylightTime(d));
 ^
2 warnings

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: