Error compiling Java using Hadoop - java

java.io.FileSystem is not public in java.io; cannot be accessed from outside package
This is the line the complier points to
FileSystem fs = FileSystem.get(configuration);
I don't understand why it cannot be accessed. Here are the imports
import java.io.*;
import java.io.FileSystem;
import java.nio.file.Paths;
import org.apache.hadoop.io.SequenceFile;
import org.apache.hadoop.io.SequenceFile.Writer;
import org.apache.hadoop.io.*;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.conf.*;
import java.util.*;
import java.io.Writer;
import org.apache.hadoop.*;

wrong FileSystem object as well as the wrong Paths object. You want:
org.apache.hadoop.fs.FileSystem
org.apache.hadoop.fs.Path
You are dealing with the Hadoop FileSystem not the default Java implementation. Recall that you do hadoop fs -ls where fs means file system on the command line.

Replace
import java.io.FileSystem;
with
import org.apache.hadoop.fs.FileSystem;

Related

lib/Pages/ChattingPage.dart:15:8: Error: Not found: 'dart:html' import 'dart:html' as html;

I got this error when I was launching my app in the emulator does anybody know whats wrong sorry I am kind of new to android studio
lib/Pages/ChattingPage.dart:15:8: Error: Not found: 'dart:html'
import 'dart:html' as html;
But I did everything correctly it's RIGHT THERE
import 'dart:async';
import 'dart:io' as io;
import 'package:file/file.dart';
import 'package:cached_network_image/cached_network_image.dart';
import 'package:cloud_firestore/cloud_firestore.dart';
import 'package:firebase_storage/firebase_storage.dart';
import 'package:flutter/material.dart';
import 'package:telegramchatapp/Widgets/FullImageWidget.dart';
import 'package:telegramchatapp/Widgets/ProgressWidget.dart';
import 'package:fluttertoast/fluttertoast.dart';
import 'package:image_picker/image_picker.dart';
import 'package:intl/intl.dart';
import 'package:shared_preferences/shared_preferences.dart';
import 'dart:html' as html;
You can not import dart:html in app for mobile (android or iOS). Remove it.
If you want use it for web application, you can use conditional import explained here.

itext DeviceGrey not compatible to setBackgroundColor in Java project

I am using iText 7 and I am trying to set the background color of my pdf table.
Cell cell = new Cell(1, 3)
.add((IBlockElement) new Paragraph("This is a header"))
.setFont(f)
.setFontSize(13)
.setFontColor(DeviceGray.WHITE)
.setBackgroundColor(DeviceGray.BLACK)
.setTextAlignment(TextAlignment.CENTER);
But DeviceGray.WHITE and DeviceGray.BLACK give errors saying that they are not compatible. The message says that setBackgroundColor(com.itextpdf.kernel.colors.color) cannot be applied to com.itextpdf.kernel.color.DeviceGray
I also have the following imports
import com.itextpdf.io.font.constants.StandardFonts;
import com.itextpdf.kernel.color.DeviceGray;
import com.itextpdf.kernel.font.PdfFont;
import com.itextpdf.kernel.font.PdfFontFactory;
import com.itextpdf.kernel.geom.PageSize;
import com.itextpdf.kernel.pdf.PdfDocument;
import com.itextpdf.kernel.pdf.PdfWriter;
import com.itextpdf.layout.Document;
import com.itextpdf.layout.element.Cell;
import com.itextpdf.layout.element.IBlockElement;
import com.itextpdf.layout.element.Paragraph;
import com.itextpdf.layout.element.Table;
import com.itextpdf.layout.property.TextAlignment;
import com.itextpdf.layout.property.UnitValue;
I realized the cause of my problem was mixing versions of io, kernel and layout. Set all of them to 7.1.10 and it works.

IntelliJ Shouldn't Import * when Importing [duplicate]

This question already has answers here:
IntelliJ: Never use wildcard imports
(14 answers)
Closed 5 years ago.
Goal:
Say I have a line of code: payout.setPayoutStatusType(PayoutStatusType.REJECTED); but PayoutStatusType is not imported in the models which currently look like this:
import models.ApprovedLead;
import models.IdentityProviderType;
import models.ImportJob;
import models.ImportJobStatus;
import models.Offer;
import models.OfferSource;
import models.OfferViewedStatus;
import models.PaymentAccount;
import models.PaymentAccountType;
import models.PayoutStatusType;
import models.Payout;
import models.PendingPayout;
import models.RawOffer;
import models.User;
import models.UserDevice;
import models.UserDeviceType;
import models.UserOffer;
My issue is if I click on PayoutStatusType, and have it create the import for this it will remove all the static imports, and just do it in one line: import models.* which I don't want it to do.
My question is this: How do I set up my IDE which is Intellij to just make it import models.PayoutStatusType
You can configure the threshold above which IntelliJ starts to 'import *':
Preferences > Editor > Code Style > Java > Imports > Class count to use import with '*'
It looks like your latest import has exceeded this threshold thereby causing IntelliJ to collapse numerous imports under a *.

Package does not exist error at a later time

My package not getting recognized at a later time.
import prasanna.AccountDetails;
import java.io.File;
import javax.xml.bind.JAXBContext;
import javax.xml.bind.JAXBException;
import javax.xml.bind.Marshaller;
import org.w3c.dom.*;
import javax.xml.parsers.*;
I have also set the classpath
C:\csj\S1>set CLASSPATH=.;
C:\Tomcat\apache-tomcat-7.0.34\lib\servlet-api.jar;
C:\Tomcat\apache-tomcat-7.0.34\lib\jsp-api.jar;
C:\Tomcat\apache-tomcat-7.0.34\lib\el-api.jar;
C:\Tomcat\apache-tomcat-7.0.34\lib\commons-beanutils-1.8.3.jar;
C:\Tomcat\apache-tomcat-7.0.34\lib\mongo-java-driver-3.1.0-20150911.172057-81.jar;
C:\Tomcat\apache-tomcat-7.0.34\lib\bson-3.0.2.jar;C:\Tomcat\apache-tomcat-7.0.34\lib\mongodb-driver-3.0.2.jar;
C:\Tomcat\apache-tomcat-7.0.34\lib\mongodb-driver-core-3.0.2.jar;
C:\Tomcat\apache-tomcat-7.0.34\lib\jstl-1.2.jar;C:\Tomcat\apache-tomcat-7.0.34\lib\jaxb-api.jar;
C:\Tomcat\apache-tomcat-7.0.34\lib\jaxb-impl.jar;C:\Tomcat\apache-tomcat-7.0.34\lib\JAXP_160.jar;
C:\Tomcat\apache-tomcat-7.0.34\lib\w3c-dom.jar;C:\Tomcat\apache-tomcat-7.0.34\lib\javax.xml.parsers-1_1.jar;
C:\Tomcat\apache-tomcat-7.0.34\lib\sax.jar;
C:\Tomcat\apache-tomcat-7.0.34\webapps\csj\WEB-INF\classes;
But still am getting the same error when I compile,
C:\Tomcat\apache-tomcat-7.0.34\webapps\csj\WEB-INF\classes>javac -d . AccountDetails.java
C:\Tomcat\apache-tomcat-7.0.34\webapps\csj\WEB-INF\classes>javac CreateAccountFinal.java
CreateAccountFinal.java:18: error: package prasanna does not exist
import prasanna.AccountDetails;

If I compile Java app at another location it can not read from any folder

I have an app. Which is in RC state. I've started finalizing works by splitting the classes to separate files with appropriate import sets at another location but suddenly I've found that cleaner version cannot read from any folder. So I investigated that if I compile the code in another location except the actual (original) app cannot read from any folder.
Strange is that from folders from those cannot be read can be obtained path (subdirectories included).
I have packed this app to executable jar file before started this works. Maybe somewhere in JVM is something stuck?
Note: New files are compiled without error. I've tried both original source and new sources.
Failure is in methods File.list() or File.listFiles(). The same using directory stream.
Used packages:
import javax.swing.JFrame;
import javax.swing.JTabbedPane;
import javax.swing.JFileChooser;
import javax.swing.JPanel;
import javax.swing.JTable;
import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JOptionPane;
import javax.swing.JScrollPane;
import javax.swing.SwingUtilities;
import javax.swing.UIManager;
import javax.swing.table.DefaultTableModel;
import java.awt.BorderLayout;
import java.awt.Dimension;
import java.awt.Font;
import java.awt.Color;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;
import java.io.LineNumberReader;
import java.io.FileReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.DataInputStream;
import java.io.FilenameFilter;
import java.io.FileNotFoundException;
import java.io.IOException;
import javax.swing.UnsupportedLookAndFeelException;
For sure at this part:
private void loadFiles(){
cesta=folderPicker.getSelectedFile();
if(folder==null||loadedCesta!=cesta||(cesta==folderPicker.getSelectedFile()&vetsiPismoVisible==true)){
folder=new File(cesta.getName());
String datFiles[]=folder.list(new FilenameFilter() {
public boolean accept(File folder, String fileName) {
return fileName.endsWith(".dat");}});
If I try:
folder.canRead()
on every folder on my PC and also e.g.on my workstation these new compilations get false as a result. Variable:
folderPicker
is reffering to JFileChooser that is limited to folders and folders are obtained via actionListener of special JButton (not classic Open and Cancel). You can try it from Karolina_RC.jar from link provided in commentary under conditions said.
Problem solved. For some reason is no longer possible to use only folder name to make File type (folder). Now it is required to use path.
E.g.
File folder=new File(path.getName());
File folder=new File(path.getPath());
Former no longer working. Latter does. I am guessing some JVM-compile issue.

Categories