--- a/cui/source/options/optjava.cxx
+++ b/cui/source/options/optjava.cxx
@@ -980,6 +980,7 @@ OUString SvxJavaClassPathDlg::GetClassPa
 #if HAVE_FEATURE_JAVA
 void SvxJavaClassPathDlg::SetClassPath( const OUString& _rPath )
 {
+#if HAVE_FEATURE_JAVA
     if ( m_sOldPath.isEmpty() )
         m_sOldPath = _rPath;
     m_xPathList->clear();
@@ -1005,6 +1006,7 @@ void SvxJavaClassPathDlg::SetClassPath(
         m_xPathList->select(0);
     }
     SelectHdl_Impl(*m_xPathList);
+#endif
 }
 #endif
 
